Yesterday, one of my colleagues reminded me that I once said that I’m going to do the minimum to maintain project X. Project X is not its real name but maybe I should back up a few steps and start with providing some background:
one of the things that happen at Netflix pretty often is that teams change, responsibilities shift and as a result, projects are handed off between teams. Project X is such a project, it was written a long time ago (more than two years back which is basically forever in our industry) by a guy that now manages another team, and was handed off to a team that currently doesn’t exist, and when that team was disassembled I was given this project.
So yesterday, the guy who wrote Project X reminded me that I said I’m planning to do the minimum to maintain it. I was surprised because one of the things that don’t fit me is to come up with such a statement, and then I remembered: WALP.
Some people will describe it like this, but I just rather say that I’ll do the maximum to be in a condition where I have to do the minimum in order to maintain an existing project. Sounds confusing? well, not really…
Project X was written in Python and had two major components (class files) which became monolithic: functions that perform multiple tasks (which goes against SRP) with hundreds of lines of code, and a few levels of nested loops – complicated to follow and understand, a nightmare to debug and horror to test.
So, in order to be able to “do the minimum to maintain it” one of the first things I did was refactoring these two classes: breaking the logic into smaller functions, minimizing the number of arguments, working according to DRY and SRP, renaming variables and functions, adding unit-tests and while I was “shaking the tree” a few bugs were discovered and fixed as well.
There wasn’t much “fun” in it, it’s not like writing a project from scratch which is really tempting to most engineers but usually is a bad idea. It’s tempting because you think “I’ll get it right this time” or “I can do much better than that” and let’s be honest: when you’re maintaining someone else’s code – it will never “belong” to you, that other guy will always get the credit for writing this project – even if the code changed so much that it doesn’t look anything like it originally did…
Back to the story, the refactoring paid off, and it wasn’t even in the long term:
* a few bugs were found and fixed
* bugs that were discovered later on, were easier to debug and fix
* I had to write a few additional features, all were implemented very quickly, easily, without any pain and were easy to test
So yes, I AM lazy, and I’m willing to work really hard to sustain it…