Lowering the Development Cost of Your Next Android App

The Android Software Development Kit (SDK) provides a great platform for developing native mobile apps. Yet, the SDK can pose some development challenges. Previously, I discussed how to overcome the challenges faced when writing unit tests for an Android app. Another common challenge is the level of flexibility the SDK provides you when developing an app.

There are simply no hard and fast rules surrounding the structure of an Android application. This can lead to inconsistency across apps and even inconsistencies within the same code base. In addition, Android apps are often filled with repetitive boilerplate code that interacts with the platform API.

Consistency simplifies maintenance by enabling those tasked with enhancing a code base to quickly learn the general architecture and follow the control flow. Frameworks like Ruby on Rails impose a policy of convention over configuration, which ensures that every Rails code base looks and feels similar. This not only lowers the cost of maintenance for a development team but makes it easier to hire additional development staff who can quickly come up to speed.

Boilerplate code is a time sync for any development team. It not only wastes time that could be spent developing features but it also makes the code more difficult to read. When choosing an Android app development framework, you should eliminate these two issues.

As the Android SDK has matured, there are now a number of general purpose frameworks to choose from, each with its own tradeoffs. Let's focus on dependency injection frameworks. Frameworks that employ this design pattern not only impose consistency but enable developers to follow the DRY principle by reducing boiler-plate code and creating reusable components. They also make it less difficult to test applications by allowing implementations to be swapped out easily.

A long-standing framework rooted in the Google development community is RoboGuice. RoboGuice is an Android port of Google's own Guice library. The framework makes development simple by stripping away all the platform boilerplate code common in Android apps. Instead, developers can focus on writing business logic. Among the DI frameworks, it has the most intuitive API and provides a simple programming model. RoboGuice's drawback is the performance impact due to its reflection-based method of injection.

Android Annotations is another great DI framework that provides many of the advantages of RoboGuice but manipulates the code base at compile time to enable injection. This avoids the performance impact of a reflection-based approach. The main drawbacks to this framework are a lack of some of the features provided by RoboGuice and a slightly awkward API. The compile time creation of classes with underscores and the unconventional annotation names (@EBean) can take some getting used to.

Dagger is a newcomer to the Android community and offers some real promise. From the developers at Square, the framework provides the same performance benefits as Android Annotations with a more fluent API. As this framework continues to evolve, it certainly has what it takes to compete with the current heavyweights.

So, if you are searching for a way to reduce the development costs of your next Android app, have a look at these frameworks. The right framework could mean that your app beats the competition to market.

Up Next

About the Author

TechWell Insights To Go

(* Required fields)

Get the latest stories delivered to your inbox every month.