When I first started programming, I was under some illusion that one day, once you learned enough about the language, runtime, or design patterns, you could hammer out some brilliant lines of code, they would work almost magically, and you’d never need to touch it again!
Boy, was I wrong.
Turns out, there’s this word. You all know it.
We have a similar word in Lean/Six Sigma. It’s called ‘Kaizen’. In short, it means continuous improvement, but it has far reaching implications. The word has its roots in Japanese culture & business (books that were written in the 80’s reference it), representing a philosophy of using data to constantly improve processes. The major focus here is that it represents incremental improvement, not “big bang” improvement. In the image below, the blue sections are slow, gradual improvements, intermingled with large jumps representing major advancements (red).
A more traditional visual of Kaizen may look something like this –
The key takeaway is that improvement happens gradually, and constantly.
A key tenet of Agile development (as argued by Dave Thomas of Agile fame) is that Agile software development is merely the process of making a small change, pausing to take a look at whether the changes have had a positive impact, and then course correcting if necessary. Looks like the chart above doesn’t it?
A major component of this is refactoring. In my opinion, every time a development team touches a codebase, they should leave the code in a better state than when they found it. The goal here should be to improve readability, performance, organization, and overall flexibility of the code. A Six Sigma-minded company pursues these opportunities to reduce waste, and only the worst run companies believe that waste is only financial.
Waste takes many forms – wasted time, effort, and talent, and all 3 of these are extremely relevant in software.
Wasted time results in delayed project deadlines, compressed testing, inter-personal frustrations, and a more rushed workflow in general, and rushing does not work in IT. Sales people and high powered business folks may work better under tremendous pressure, but trust me, developers don’t. Coding is a calculated and involved mental activity.
Wasted effort turns a 1 hour task into a 4 hour one. It means you spent 3 hours copy pasting data from a spreadsheet into a custom JSON structure used by your app, only to find that in the end, it needed to be CSV format, and you could have just done a straight export from Excel. Additionally, developers love efficiency hacks. If wasted effort becomes a routine occurrence, they will rapidly become frustrated with their job, and will have reduced output and problem solving ability. This makes for reduced team morale, and potentially increased turnover – something that HR teams may raise their eyebrow at you for.
Wasted talent is a truly hidden waste, and can silently kill large companies who are not prepared to respond. A good friend of mine works extensively in finding and retaining the best talent for his business teams, and we’ve discussed this at length. Hopefully I don’t need to justify this point, but if you think that all developers are worth the exact same amount, you have much more to learn about high quality software development. Steve Jobs probably could probably explain this better than I could.
Refactoring took me many years to fully appreciate, and I must admit, I’ve really come to love it. It can feel like it can be its own art form sometimes. Now, if you don’t have unit tests as insurance for all of your changes, you should probably go back to basics and get those up and running. “Deploy with confidence” and all that.
There’s a ton of great material out there on refactoring, and I have yet to pick up my copy of the Fowler book on it. But, I’m keeping it simple. Know your code smells, and make a series of small improvements in an effort to reduce waste. If the design problem presents itself, maybe integrate a design pattern and assess the solution in a code review. Over time, trust in the process that your codebase will improve over time. The next developer will love you for it!