This post, like Kent Beck says in his book Implementation Patterns,

“ based on a rather fragile premise that good code matters”.

But we all know that good code matters as we’ve had to deal for so long with its lack. And so does Kent.

The Total Cost of Owning a Mess

A few years ago, like every naive Android developer working in an early-stage startup in India, I tried to “hack” real world problems, to “disrupt the industry” and to put a “dent in the universe”. Without a care in the world about good software design or architecture, I started writing code to build an Android app that would one day become one of the biggest consumer heath-care apps in India.

Sprint after sprint, hack after hack, features were built in a mad rush. Build. Measure. Learn. Time-to-market was important and every day mattered. Time flew by, we were growing at the rate of 1 team member every 6 months and the app had hit the million downloads mark.

By this time, the app had stopped being trivial and it had become a multi-tenant client, if that’s even a thing. Features that would take hours when we started now took days, sometimes weeks. Every Activity was 1000+ lines of spaghetti code as Android inherently doesn’t worry too much about the separation of concerns. The total cost of owning a mess had significantly slowed us down.

The Android Conundrum

The code looked ugly, Activities managed everything:

  • Threading
  • I/O
  • Computation
  • Layouts
  • Config changes
  • What not

After all, Activities are Controllers, right? Or are they Views? I didn’t know anymore.