Androidsx Androidsx | android and wearable developers

 

Subscribe for market insights and new posts

 

Technical Debt In Android App Development

January 7, 2013 at 5:06 pm | android, blog, software quality | 14 comments

 

Many indie developers think they can get away with introducing hacks all over the place while developing an Android application. Those shortcuts do speed up development. Probably, they’ll even take you closer to the launch day.

However, chances are that they’ll end up doing more harm than good.

The main reason is pure technical debt. Technical debt makes reference to the work that remains to be done in a project in order to consider it complete. All those hacks contribute directly to it.

As described in a a CAST report, the technical debt is like a ticking bomb: first, it doesn’t go off with a bang, it’s more a slow burn. Change starts to take longer… and operation costs start to spiral — it will not be a single cataclysmic event; it will be death by a thousand cuts.

In this list, we’ll attempt to classify the different types of technical debt, sorted by how much damage they inflict:

  • Choosing the wrong technology for your platform. Migrating to a different technology usually implies changes at many different levels, plus learning the new platform. A very costly process. This doesn’t usually apply for an Android app, tough.
  • Designing the wrong architecture. If the architecture does not fit the problem it intends to solve, extensions become more and more cumbersome, until a major rework may remain as the only alternative to scale. This is usually a huge task to tackle. This applies for big applications, where several layers communicate to each other.
  • Error-prone code. Code that is hard to understand, and thus expensive and dangerous to modify. Also, difficult to extend. It was perhaps originally done badly, or it worsened with subsequent modifications. Many of those hacks fall within this category.
  • Code that is difficult to test. If it is difficult to test, chances are that it falls in both the previous (Error-prone code) and the following (Poorly tested system) categories. Testing costs tend to go up with future changes, which just makes things worse. Remember that even if you don’t create an Android Test project, or you don’t do GUI testing, you can still write traditional unit tests for the critical modules of your application. You’ll be glad you did.
  • Poorly tested system. This leads to the classic I fixed X, but broke Y by mistake. No tests warned you about it. As a consequence, one tends to become lazy when it comes to improving the design: attempting to refactor a poorly tested system is scary. On the other hand, a well-tested code base provides you with confidence to improve things with a higher expectation of succeeding. After many releases, the time spent doing manual testing (aka click around before the release and hope everything works as it used to) will surpass the time it would have taken to write proper tests in the first place.
  • Duplicated business knowledge. if the DRY principle is applied successfully, a modification of any single element of a system does not require a change anywhere else. Often, the “rename” operation is expensive and extremely error-prone. In practical terms, your constants are defined in a single, central location, right? How about your assumptions about what extras your activities accept, or the data format you use for storing data into persistent storage?
  • Missing or poor error handling. Does your application let Force Closes happen? Or even worse, does it catch exceptions and try to go on as if nothing had happened?

  • Inefficient implementation. Isolating the bottleneck, profiling and fixing it is not an easy task. If your application is a service, do make sure you won’t drain the phone battery. You really want your applications to feel responsive in all supported devices.
  • Code that works, but nobody quite understands why. Usually somebody that left wrote it, and it’s been running untouched for a long time. Sooner or later, somebody is going to have to fix it or adapt it to whatever external change. That may be expensive in terms of time and frustration.
  • Outstanding bugs in code and unresolved static analysis warnings. It depends on the severity of them. However, many of them may have been there already for a long time, and didn’t cause any real problems yet. A cheap fix.
  • Duplicated code. This is one of the first things that comes to mind when discussing technical debt. One of the star features of static code analysis tools. But, how bad is it? In a given codebase, there may be several versions of some assertContains method. Sure, we’d be better off if they were in some commons library. But how much harm do they do, in terms of maintenance costs? I’d argue it’s not much.
  • Outdated documentation. Out-of-date documentation can lead you in the wrong direction, when it claims things that don’t hold anymore. Write little documentation, but make sure it is close to the code, and up to date.
  • Bad style: magic numbers, missing comments, wrong indentation, … Untidy code is more tedious to read. But this is trivial to fix. (By the way, fixing the formatting is fine as long as it is not done in the same changeset as a change in the actual logic.)

The point is, use your limited time in the most effective way. Fixing all warnings feels good, but, does it help that much? Did you make sure your design is scalable?

Talking about scalable designs, we pretty much killed our suite of News Reader applications because of a few bad design decisions. Long, long time ago we launched AnyRSS, a simple, widget-based RSS reader. It is the parent application for several other single-RSS readers, such as FML. They were great, the CTR in both Admob as well as Mobclix for them was really high, compared to our other applications. As you can imagine, all these applications share almost all functionality. But the architecture was just not right.

We are definitely not doing the same mistakes with Chat Toolkit and Smileys For Chat. The setup is similar: several free applications perform upselling to a paid one. Not a single line of code, not a single string, is duplicated (well, almost). Several module libraries collaborate to create these applications, and they have well-defined responsibilities and APIs. Coding new features is just so easy as doing it on top of a Hello World app, and most modules have a way of running in stand-alone mode.

There are other reasons why you want to keep a well-designed, clean, clearly documented codebase. What if you want to bring in a contractor to help you out? Will it be easy for them to get up to speed? Or is it just impossible? Can you give them one single module on which to work, or is the whole code a piece that can’t be easily decomposed in subpieces (i.e., different JARs)?

Also, are you proud of your code? Would you publish it into GitHub? Maybe at some point you want to have some of your code published while considering a job change? But, is it good enough to be out there in the open?

Some interesting articles we have checked out in order to write this post:

Related posts

<< Back to Blog Discuss this post

 

Checkout our new pet project:

Subscribe to our newsletter

 

14 Comments to “Technical Debt In Android App Development”

  1. [...] in poor implementation. This can result in apps that meet the immediate need and cost but cause a technical debt.  For some kinds of apps, such as advertising or marketing apps, that are one-offs, this might [...]

  2. [...] in poor implementation. This can result in apps that meet the immediate need and cost but cause a technical debt.  For some kinds of apps, such as advertising or marketing apps, that are one-offs, this might [...]

  3. Anele Ivanova says:

    Hi,

    Recently I came across some great articles on your site. The other day, I was discussing (http://www.androidsx.com/technical-debt-in-android-app-development/ ) with my colleagues and they suggested I submit an article of my own. Your site is just perfect for what I have written! Would it be ok to submit the article? It is free of charge, of course!

    Let me know what you think
    Contact me at anelieivanova@gmail.com

    Regards
    Anele Ivanova

  4. Thanks for the articles Anele Ivanova a very good read right here!

  5. Aadam Gibson says:

    Technical debt is very helpful for creative innovation and to improve our technical knowledge. Thanks for posting useful debt for android developers.

  6. [...] This is another problem with some developers. They love to invent or use mechanisms that might not be needed. I have worked at some large companies where there have been tens of implementations of ‘String’ in the same product just because developers thought they could do better. I have also worked on others’ code that has been over ‘Design Patterned’ that have led to a technical debt. [...]

  7. [...] This is another problem with some developers. They love to invent or use mechanisms that might not be needed. I worked at a large company a long time ago, that happens to be source of this article, where there were tens of implementations of ‘String’ in the same product just because developers thought they could do better. I have also worked on others’ code that has been over ‘Design Patterned’ that has led to a technical debt. [...]

  8. sumit kher says:

    This is very inspiring, it kind of described how I got started developing in SecondLife (LSL is a java-like language).

    Having no real background in programming (aside from making some adventures on ZX-81 and MSX), this does sound like I could get started on developing something for my own Android based eBook reader and android app development training even this online course seems to be interesting http://www.wiziq.com/course/13599-professional-android-app-development-training-1-on-1-sessions. Has anyone tried any online courses so far. Please do provide a light on this also.

    Thankyou for all the info also.

  9. dotNear says:

    A great article, this is something every android application developer should know.

  10. Hey Sumit, I’d suggest you start to do some development on your own while you attend some course on programming fundamentals. It is by doing cycles of try-fail-research-tryagain-succeed (well, oversimplificating a lot here) that you’ll learn. Also, building your own app will keep your motivation high up!

  11. For the beginners this is really nice post.because this provides basic concept of android development.both the part are good for viewers.

  12. Lee Wright says:

    very cool list. thanks for sharing.

  13. Do you mind if I quote a couple of your articles as long as I provide credit and sources
    back to your site? My blog site is in the very same area
    of interest as yours and my users would really benefit from
    a lot of the information you present here.

    Please let me know if this okay with you. Many thanks!

  14. Thanks for sharing such a great concept of android development, i really didn’t know about that, will get advantage from this..

Leave a Comment

Categories:

Recent posts:

Search:

Subscribe