Managing Android Devices

Google has quite a task ... to manage an installed base of over a thousand different types of Android devices. Multiple sizes, shapes, features, etc. The positive way to describe this is variety. On the other hand, it has also been refered to as fragmentation.

So how do they do it? In short, leverage. A good metaphor is a mechanical shovel. Relatively compact machines can move and lift very heavy objects using a system of joints and lever articulation. Android does something similar.

The code in Android applications doesn't manipulate devices directly. There are intermediate joints and levers that make the task manageable. Application code is programmed using component names to refer to layout elements. Layouts are adjusted to device characteristics automatically by the Android operating system. This lets an individual line of code manipulate many different types of devices.

This is a simplified view of how it all happens. There are a number of Android features that make it work: Themes, Styles, Action Bars, Fragments, Resources and much more. When implemented properly, an Android application can move a thousand different types of devices.

Coding for Better Understanding

A recent article in the Communications of the ACM focuses on how to improve the understandability of code. "Coding Guidelines: Finding the Art in the Science" by Robert Green and Henry Ledgard addresses a number of often overlooked aspects of code design, including:

  • Statement alignment.
  • Component naming.
  • The use of white space.
  • Syntax highlighting.

Many developers feel that work done to improve the appearance and understandabililty of code is wasted effort. They will often work to make code as compact and sometimes as obscure as possible.

This might work well for them while the function of the code is recently developed in their own head. But someone, even themselves, trying to maintain or improve the code sometime in the future would likely find it very difficult to understand.

Using principles such as those above can, over the long run, decrease development costs and improve code performance.

Dealing with Android Fragmentation

So called Android fragmentation is caused by the large number of Android device types and operating system versions deployed in the market.  It's the flip side to the benefit of having a wide variety Android devices and capabilities.

There are currently over a thousand different types of Android devices on the market. It's simply not possible to support all of these without accomodating variations in device design.

Google provides a number of tools for addressing the compatibility necessary to serve this diverse universe of devices. These include:

Unified Support for Tablets and Handsets

Android 4.0 combines the support of tablets and handsets into a single release.

The Holo Theme Family

In Android 4.0 Google has made the inclusion of the unmodified Holo theme family a compatibility requirement for devices running Android 4.0 and forward. This will provide a level of uniformity across device implementations.

Support for Multiple Screens

Provides mechanisms for supporting multiple screen sizes and densities.

Action Bar Backward Compatibility

Google has recently developed a set of classes to give the Action Bar backward compatibility for pre Android 3.0 devices.  These classes invoke the action bar design pattern on pre-API 11 devices and the built-in Action Bar on devices supporting API 11 or greater.

Android Compatibility Package

This library is available through the SDK Updater. It gives backward compatibility for the new Fragments feature.

Compatibility Guidelines

Google provides guidelines on achieving compatibility across devices.

Android Action Bar Backward Compatibility

The Action Bar is a consistently formatted navigation and option selection area at the top of a screen with an overflow area at the bottom.
 
Key aspects of the Action Bar include:
  • It's a replacement for the menu feature.
  • It was introduced in Android 3.0 and refined in Android 4.0.
  • It's included in activities that use the Holo theme family.

Elements of the Action Bar graphic include:

  • Application icon.
  • Application name.
  • Up navigation to a parent screen.
  • Built-in tab navigation for switching between fragments.
  • Drop-down list for alternative navigation such as sort by a different criteria.
  • Important actions for a given app such as search and share.

Google has recently developed a set of classes to give the Action Bar backward compatibility for pre Android 3.0 devices.  These classes invoke the action bar design pattern on pre-API 11 devices and the built-in Action Bar on devices supporting API 11 or greater.

This is part of a larger set of capabilities for supporting application compatibility with multiple device environments including tablets and handsets and various screen sizes.

New Android Design Guidelines

Google has just released new, and very helpful, Android design guidelines. They're detailed on the Android developer website. The main webpage is shown below.

It's great to have these guidelines grouped in one place for easy access and they appear to be a step forward in developing an improved user experience ... both for the operating system and applications.

Using JavaScript, jQuery and HTML5 with Cloud-Based Web Development Tools

Cloud based web development tools (such as Squarespace) are making web development easier. Their WYSIWYG editors even make simple web update accessible to non technical users. Web developers can concentrate on the more complicated, higher value added tasks, while their clients make simpler updates such as text changes and blogging.

By adding JavaScript, jQuery and HTML5 to the mix, sophisticated, cost effective websites can be developed. 

Using Concept Maps with UML Components

Concept Maps are a useful way to graphically document the relationships between the elements of a system. Not only do they assist in the system design process, but they can be used to communicate design ideas to stakeholders such as users and management. Unified Modeling Language (UML) is a more structured form of concept maps focused on Object Oriented Programming (OOP.)

We've found that combining tools and including useful graphic elements such as screen shots creates a very user friendly design tool.

Programming Languages: Java vs. C++

We're often asked about the differences between the Java and C++ programming languages and why Android apps are written most often in Java.

The table below highlights some of the differences between the languages. Basically, Java is better suited to the fundamental programming (using the SDK - Software Development Kit) for most app functions. C++ is used (with the NDK - Native Development Kit) in circumstances when high performance or easy re-use of existing C++ code is important. 

Object Oriented Programming Data Structure Decisions

When it comes to organizing data in an Object Oriented Program, there are lots of choices and decisions to make. It can at times be difficult to think through all the criteria for selecting and implementing the right data structure.

The decision table below can help work through the data design process.

Object Oriented Programming Design Patterns

OOP Design Patterns are development templates that give software designers and coders shorthand ways of thinking about and solving programming challenges.

A full explanation of OOP Design Patterns can (and does) fill entire textbooks. Understanding and remembering every aspect of every pattern can be a daunting task. Hopefully the brief descriptions below will help in remembering the function of some common Design Patterns.

Often programmers need to discuss pattern usage with software designers, managers and other programmers. Getting too lost in the details can distract from communicating the essence of a software solution. Design Patterns can help with these challenges.

Some commonly used Design Patterns are listed below. Click on the Design Pattern name for a full pattern description.

  • Adapter - Facilitates object interaction.
  • Bridge - Similar to the Adapter pattern but more robust.
  • Builder - Similar to the Factory pattern for returning objects as an output but used in cases where many variables of output object construction are needed.
  • Chain of Responsibility - Uses a sequence of processing code blocks, each of which handles a specific set of conditions before passing control to the next block.
  • Command - Used to store and use the information needed to call a method at a later time.
  • Composite - Describes that a group of objects is to be treated in the same way as a single instance of an object.
  • Decorator - Also known as a wrapper, allows behavior to be added to an individual object.
  • Facade - Provides a simplified interface to a larger body of code.
  • Factory - Creates objects as a return output.
  • Flyweight - Minimizes memory use by sharing as much data as possible with other objects.
  • Interpreter - Specifies how to evaluate sentences in a language.
  • Iterator - Used to traverse a container and access the container's elements.
  • Mediator - Defines an object the encapsulates how a set of objects interact. Instead of communicating directly, the encapsulated objects communicate through the Mediator.
  • Memento - Provides the ability to restore an object to its previous state, such as an undo via a rollback.
  • Null Object - Object with defined neutral ("null") behavior.
  • Object Pool - Set of initialized objects kept ready to use, rather than allocating and destroying them on demand. Thread Pools are a common Object Pool implementation.
  • Observer - Maintains a list of other objects and notifies them of any state change. Objects that perform Callbacks operate as an observer.
  • Prototype - Similar to the Factory pattern, creates objects based on prototypical instances.
  • Proxy - Functions as an interface to something else.
  • Singleton - Restricts the instantiation of a class to one object.
  • Strategy - Enables an algorithm's behavior to be selected at runtime.
  • Template - Defines the program skeleton of an algorithm and defers some steps to subclasses.
  • Visitor - Separates an algorithm from the objects on which it operates.

Rooting - What It Is and Why to Think Twice Before Doing It

In brief, rooting your phone refers to making changes to the phone operating system so that you can load a different version of the system than the one that's pre-loaded into your phone.

Reasons users root their phones include: enhancing performance, to get a different look and feel, to have more flexibility in what software can be used, getting the latest Android releases and to have some technical fun.

The term rooting refers to getting privileged root control access within the Android Linux core system. Rooting is necessary to install custom versions of the Android system. One of the more popular of these is CyanogenMod. It offers such features as improved sound processing, additional display themes and improved processing speed.

There has been quite a bit of controversy over rooting. Some vendors and carriers discourage it and some support it.

Potential risks include: voiding your warranty, loosing data and "bricking" your phone thus rendering it inoperable. Those that choose to root are comfortable with these risks and see them as being outweighed by the  benefits. They're also willing to invest the time needed to make sure that rooting is done correctly and can be undone if something goes wrong.

The exact process of rooting can vary by type of device. It's necessary to find instructions specific to your Android phone. There are websites dedicated to rooting where you can find this information along with help for dealing with problems caused by rooting.

Essentially, rooting involves "flashing" (changing) a phone's ROM, or Read Only Memory. There are ROM Manager apps available on the Android Market that can be used to backup, change and restore ROM contents.

So, if you have the time and sense of adventure, rooting might be just the right thing for you. 

If not, you can wait for new phone releases to bring you many of the benefits of rooting without the risk and hassle.

Android 4.0 (Ice Cream Sandwich) Released

Google's latest Android release is now available. You can find a good summary on the Android website.

There are significant improvements/additions to:

  • User Interface
  • Multitasking
  • Voice Input
  • Control Over Network Data
  • Social Networking Interfaces
  • Camera Capabilities
  • Gallery and Photo Editing
  • Web Browsing
  • Email
  • Wi-Fi Connection
  • Unified Framework for Phones and Tablets

Look for phone manufacturers and service providers to start releasing phones running Ice Cream Sandwich.

The Software Revolution

As software transforms industry after industry, it's becoming apparent that the world is transitioning to a software driven paradigm that won't be denied.

Manufacturing, entertainment, journalism, music ... they are just a few of the business domains that have been dramatically altered by the power of software.

Software often gives an order of magnitude or two advantage to the new businesses that fully leverage its capabilities.

Some of the effects on society are profound:

  • Radical lowering of costs.
  • Shifting of the demands of labor from the physical to the intellectual.
  • Increasing the rate of change.

What are some takeaways for businesses large and small?

  • Embrace the change ... don't fight it.
  • Try to get ahead of the curve instead of playing catch-up.
  • Develop an understanding of the latest new technologies, which are, today, things like smartphones, cloud computing and tablet computing.
  • Don't rely on yesterday's technology to carry the day. Witness the speed with which tablet computing is replacing PCs.
  • Give some of the latest technologies a try. Test them. See what they can do for you.