While I was sipping my coffee, reading the umpteenth blog post on MVVM vs MVC vs MV-something (by the way, have a look here), the project manager came around and said: “Fabio! Our customers would like to display their expenses within a time frame. I think it’s easy, it’s just another date field, and it will make our app shine among other competitors. Can we get this s**t done tomorrow?”.
Ye sure, why not? It’s a great feature to add, and it should be easy.
Let me open my ExpensesListViewController, let me add another UIDateTimePicker, change the API logic (a singleton). Commit, push, approve, archive and release.
I am satisfied; my PM looks at me as “the truly the king of the kings”. Great job. Congratulations!
Now, Fabio, try to add another DateTime picker, update the logic (and try not to break the existing one) in that view controller.
Can you see your estimation falling over and your PM breathing down your neck? Are you feeling the pain?
Broken Window Theory
By Karan Jain from Washington, DC, USA – broken windows., CC BY-SA 2.0, https://commons.wikimedia.org/w/index.php?curid=22625973
If you ever read “The Pragmatic Programmer” (if you didn’t, buy it), there is an interesting theory called “Broken Windows Theory“. Crime researchers discovered a trigger mechanism that turns a neat and occupied building into an abandoned derelict: a broken window.
If a window has been left unrepaired for a substantial time, it implants a sense of abandonment in the residents. So another window gets broken, people start littering, etc., until the perception of abandonment becomes a reality.
Can you relate this theory to the software?
Poor code and bad architecture/design, wrong decisions, etc., are like leaving the windows broken. Don’t live with broken windows. Don’t let your code rot!
Fix them as soon as discovered, and if there is no time, don’t let it slip away! Create a tech debt ticket and pay off your debt tomorrow; otherwise, you will pay the interest! And, trust me, it’s not pleasant when you are in arrears!
Nice words! How can we fix the broken windows?
Don’t get me wrong. For some projects, for some tech-culture, this is absolutely fine if it’s fine for you too, of course.
This blog serves to explore all the techniques I learnt during my experience. And I hope that this blog will help you. And also help me to learn other things from you with the comments! See you in the next blog post to explore how to fix this messy project!