A couple of years ago I had what looked like a leaky sewage pipe in my apartment. We started taking out the wall to get to the root of the problem. It wasn’t long before half of the apartment was stripped to the bones.
During one of our long and sweary smoke breaks, my builder—normally a chatty fellow—grew awfully quiet, took a long drag of the cigarette and said: “It’s easier to tear everything down and build a house from scratch”.
This is exactly how software works.
As Joel Spolsky put it, programmers, in their hearts, are architects. They want to build things—not tinker, fine-tune and refactor. It’s much more fun designing a house from the ground up instead of trying to figure out where the previous owner hid all the wiring and please dear god tell me it’s not buried behind the extremely flammable insulation (it is).
But you can’t always tear everything down and start again. The old code might be ugly and bloated, but that’s probably because it’s holding back horrible, ancient bugs that you and your users have long forgotten about. “It’s ugly” is never a good reason for a rewrite. Over time your program might slow down, but this can be alleviated by slowly and systematically swapping out the really messy bits, even if it requires the worst thing imaginable—reading and understanding someone’s old code.
It may be tedious. But if done carefully and with proper testing, refactoring will be a lot faster than a total rewrite.
About the comics
When not refactoring Toggl, we like to blow off steam by teaching programming concepts with comics. You should take these teachings with a grain of salt, but we like to think they’re more accurate than not.
Recently we explained the differences between waterfall, agile and other development methods with space rockets. We’ve also done a retelling of the fairy tale classic Little Red Riding Hood with different programming languages.
What is Toggl?
Toggl is a simple time tracking app that helps you see where you’re spending your working hours. Time can slip away if you’re not paying attention, so it’s handy to have a tool that tells you how long you’ve spent on your work projects.
We’ve also developed a couple of other tools to make organizing work easier—Toggl Plan is a neat team calendar and planner and Toggl Hire is our test-based hiring tool.
Mart has a background in anthropology - a discipline which has turned people-watching into a science. He most enjoys working on projects that make you go from “that’s stupid” to “hmmm”.