Vigilant Software Blog
Make Inertia Work For You
It's been said that learning to program is something like acquiring a super power. You get to tell computers what to do and they have to listen to you. Feats that are impossible to the average person are not only possible for you, they're easy.
This power can be used for trivial, every day things, like customizing your computer's or smart phone's interfaces (especially if they're open source). Or you can use this power to analyze 80 years of stock market data and try to get rich predicting the next move. Or you can use it to scrape eBay and craigslist for good deals on antiques.
Given how versatile and useful this power is, it's remarkable to me that developers often neglect to use it.
Warning Signs
Does it feel like developing your project is an uphill battle, constantly taking steps backward and struggling to get a foothold? Do you have a great development team, yet your application quality wavers and things feel more unstable than they ought to be? Does every bug feel like a heisenbug?
Hopefully, you have a development process that involves some rules about what developers should or shouldn't do. This could be things like:
- Test that you haven't broken anything prior to committing new changes.
- Update the changelog after a commit.
- Never use platform-specific APIs.
- Format code according to a coding standard.
Developing a nontrivial software project is a constant battle against complexity and entropy. The holy grail is the ability to develop new features while introducing zero regressions and spending zero time on maintenance.
Without automation, the normal state is a sort of controlled chaos. Everyone makes a best effort to follow the procedures, but, being human, they occasionally forget. Or they each interpret the rules differently. Or ther code works on their systems, but fails somewhere else (or everywhere else).
Why is this happening?
Here's the problem with rules that people need to manually follow: every single time, the person must overcome inertia and summon the energy required to perform some (probably tedious) tasks. Even if the manual steps are small, they still represent some energy threshold that must be crossed to make them happen. That means that there will be occasions where someone is tired, distracted, or forgetful enough, and a shortcut is taken.
Even when you are mostly successful at manually applying rules like the above, it is a drain on your productivity. If you have to perform manual testing every time you make a change, you are draining energy away from developing new value and pouring it into simply maintaining the status quo.
Super Cow Powers?
It's time to bring that super power to bear on this problem. Conveniently, things that are boring and tedious are perfectly suited to being performed by a computer (at least until they become self-aware). These are problems that we can solve with software, usually with a minimal amount of scripting and tools like CruiseControl or Jenkins.
We can use automation to not just overcome inertia, but create a new steady state. That is, create a development process that is self-sustaining and increases your product's quality with nearly zero overhead.
Here's what to do:
- Have a test suite that can be run at the push of a button. It should run quickly and every test should pass every time.
- Automate your tests and run them (at least) every night. Even better, use continuous integration and test after every push.
- Automate enforcement of any coding standard that can be enforced programmatically. Ideally as a pre-commit hook.
- Automatically generate documentation from code wherever possible.
- Add regression tests whenever you fix a bug, so that bug can never reappear.
Automating development and testing tasks is an almost magical thing. It brings a certain kind of peace of mind to get a clean, passing test suite every day. You can sleep at night. And it makes inertia your ally rather than your foe: the new steady state is one that maintains stability and doesn't drain your energy in the process.