A colleague, Erik Lundh, usually talks about ‘discipline in the small, [gives] freedom in the big’. To me this makes a lot of sense. Like, when I’m not performing at my best. I’m usually thinking along the lines ‘This time, and this time only …’ or ‘Just a little more of this, it won’t hurt …’. or even ‘What could possibly go wrong with this little snippet of code …’. That is, if I’m having a bad day and I’m not able to pair program.
Soon enough the problems have stacked up and you’re knee deep in them. So far down that it doesn’t matter where you will go next or what you might do. It’s already a mess. Recognize this behavior? Do you, your teammates or anyone you know, behave like this or used to? This is often referred to as ‘The broken glass syndrome’. When a glass breaks on a house, for instance, fix it immediately or problems will be pushed ahead of you with the excuse ‘Later, I’ll fix them later’. But these problems very seldom get the attention they deserve.
So, why do you need to tend to your problems early? Why do you need discipline? Because this gives you the freedom you want in other areas. Maybe the chance to do something fast or different when you need it more. In fact very often when you need it the most. Let me illustrate this with a few examples from the world outside of programming.
- Exercise regularly and stay fit -> Enjoy nice food and beverages
- Save small amounts of money regularly -> Invest in something you really want later
- Keep in touch with your friends -> Have a shoulder to cry on when you need it the most
If you exercise the habits to the left you will get a chance to enjoy the things to the right. You even get the freedom to choose to do this whenever it fits you the most. To put things in another way; One can rather easily imagine what happens if you make a habit out of abusing the things to the right. My guess is, you won’t get the results you were looking for.
What about programming then? Well, I’m going to make things easy for you. Below I have mapped the habits above to coding practices for you.
- Test drive your implementation -> enjoy clean code and APIs and avoid tedious debugging
- Refactor often and simplify -> add new features with ease
- Keep designing incrementally -> change direction at lower costs
There are a lot more analogies you can make and I challenge you to make these in your every day work. The next time you’re trying to take a shortcut or skipping a test case. Think about what you’re risking. Think about what you’re missing out on. The fact that you can’t even know what you’re risking should scare you straight though. Just about anything might turn up when you least expect it. Remember Murphy.
I know myself and I have seen people drop the ball numerous of times and slip back to non disciplined behavior. Get up, start over. It’s never too late. And get yourself a pair programming partner while you’re at it.
Keep disciplined, stay free …