How to harness the power of laziness (for software development)
Humans are lazy. Evolutionarily it’s an adaptive trait, helping us to get the most value with the least effort. It’s also what led us to innovate and create tools, which let us do more with less work.
Laziness is a double edged sword though. Innovations that can help us out greatly in the long run often come with an upfront cost requiring lots of thinking, experimenting, and good decision making. However, as lazy humans, we’re likely to want to take the path of least resistance.
Software engineering is quite possibly the pinnacle of laziness, allowing us to do vast amounts of calculations that wouldn’t be possible to do by hand, but it’s quite taxing
Here are some tips to make sure developers have an obvious and easy route to take, so the laziness works in our favour instead of against us.
Abstract as soon as it’s clear
It’s often far easier to copy and paste a bit of code that almost does what you want and tweak it to your needs than it is to work out an appropriate abstraction, extract it, and refactor both to use that. But, when that abstraction is made, it becomes a lot easier to use that much more appealing lazy solution. And oh boy is it easier to extract earlier than later, so jump on the opportunity to abstract as soon as it’s clear what it should be.
Enforce code quality
Better code quality and consistency in terms of code style help make your code base easier to read, and work out what parts can be used as tools to solve bigger problems. Strict linting can be an easy way to prevent prevent poor quality code sneaking in.
Test drive your development
Tests arguably are the least sexy part of coding, and often slip away at crunch time. Test driven development has you write tests first, and then write code to pass those tests. Your code will never be untested, and you don’t write more code than necessary to pass the tests. What could be lazier?!
Review code and act on it
Sometimes you can’t see the wood for the trees when you’ve been coding for a while, so take code review as an opportunity get suggestions for possible refactors, often it helps to have a fresh pair of eyes on the problem. As a reviewer, you don’t even have to do the hard work of writing the code, simply point out where you can see mistakes and potential improvements that could be made. Most importantly though, make the changes immediately, the longer you leave it the less likely it is to be done.
Now get out there and be the most effectively lazy developers you can be!