Daniel Irvine on building software
30 June 2014
Software craftsmanship puts heavy emphasis on discipline. It’s often hard to quantify exactly what discipline is, but we can think of it as the opposite of laziness. Software development is a skill, and just like other highly precise skill sets--martial arts, gymnastics and athletics, to name a few--it requires not just practice but disciplined practice, and not just disciplined practice but a lifetime of disciplined practice.
The reward for being disciplined is constant progression toward mastery. Each new technique we learn must be perfected by timeless practice. As we internalize these techniques with immaculate precision, we open space in our minds for newer and greater lessons.
If instead we are always sloppy and never perfect the easy lessons, how can we ever progress to the harder lessons?
Examples of software engineering discipline
Here are some specific ways you can be disciplined in your daily practice. How many of these do you strictly adhere to?
- Always commit early and often--perhaps after each time all tests are green.
- Never write vacuous commit messages. “Updated tests” or “new class” helps no one.
- Never check in code that you aren’t proud of--refactor until it’s the best it can be.
- Never write tests simply to maintain coverage. Your tests should equate to specifications, and that should be enough to maintain coverage.
- Always delete unused code. Don’t comment it out. If you need it again, it’ll be there in your source control system. (You have one of those, right?)
- Ensure your methods, types and variables are all named well. If you’re refactoring, don’t forget to rename when it makes sense.
- Minimize time spent surfing the Internet. Turn off Facebook, Twitter, and even your email when you’re getting work done.
- Always delete extraneous comments in your codebase and strive to never add in new comments!
- Never disrespect or disparage teammates--have the mental strength to see the value in everyone.
- Always listen to others carefully when debating issues.
That’s a good start but the list is endless--I’d be keen to hear other practices that you follow daily.