My wife is a school nurse, and this week at her school she is promoting a hand-washing campaign called Don't Bug Me. The idea is that if we teach kids to wash their hands frequently (after meals, after going to the restroom, after sneezing, after shaking hands with someone, after each time someone uses the word pamphlet, etc), we can eliminate germs and stop the spread of disease before it starts.
This is a GOOD thing, and a healthy habit to acquire. Sounds like a good software habit too. Let's stop those bugs in their tracks before they even get started. In that vein, I thought it would be interesting to think about some healthy personal habits and how they correlate to software development.
Habit #1: Wash Your Hands Frequently (Unit Tests)
Bugs will crop up as you code. It's virtually unavoidable - just as you can't avoid getting germs on your hands. The key is to wash your code frequently by running unit tests. This helps you find the bugs as you go and flush them out. A developer that is working without unit tests is like somebody that doesn't ever wash their hands after they go to the restroom. You may not get sick today, or tomorrow, but eventually it's going to catch up to you.
Habit #2: Exercise Regularly (Stress/Performance Testing)
The human body needs regular exercise to make sure all of our systems run smoothly and efficiently. By exerting ourselves, we ensure that our systems work under stress, as well as improve their normal function. The same is true of any software system. By putting it under stress regularly, you will improve it's overall health.
Habit #3: Keep Things Clean (Refactoring)
In our homes, we regularly clean places that we know germs are likely to build up - especially places with "bad smells" like the bathrooms, kitchen sink, refrigerator, and dirty carpet or floors. It's vital to healthy software development that we do the same thing with our code. We must diligently search for bad smells that indicate problems with the code and clean them up as we go along. I find that this is one of the hardest things to get people to do. People are just reluctant to change things - standing by the old line, "if it ain't broke, don't fix it." But the problem is that over time the "bad smells" add up 1 by 1 to make the code really stink, and it becomes difficult to find and fix bugs or add features without a serious spring cleaning.
Habit #4: Frequent Checkups (Continuous Integration)
New moms often take their newborns and toddlers to the doctor for a checkup every couple of weeks to make sure they are developing properly and see how they compare to "normal" development for their age, weight, etc. Software should be developed in the same way. We want to make sure, as often as possible, that our "baby" is developing normally - that all of it's systems are functioning and integrating together and that it is progressing as it should. Continuous Integration - the act of building and exercising any automated tests after each code check-in - is perfect for this, providing a consistent measuring stick of a project's health and well-being.
Habit #5: Take Your Vitamins (Perpetual Self-Improvement)
Taking a daily dose of vitamins has been scientifically proven to improve long-term health. There are several ways to correlate this to software development. Primarily, I believe that taking vitamins in the software world means perpetually improving your technical skills and knowledge. For me personally, my daily vitamins primarily consist of a good dose of blogs (I like to think of Scoble as Vitamin B12 and Joel on Software as Vitamin C). I recommend subscribing to as many blogs as you can keep up with (whether that's 10 or 1000) - from giants in the industry to Joe Developer. You never know when one will provide the spark that you needed or the technique you've been looking for.
There are other ways to get your daily recommended nutrition - reading technical magazines, books, taking training, etc. The important thing is that you are doing this regularly and learning about a wide variety of topics (multivitamins?). This will improve the health of the code you write by providing you with the latest tools and techniques, and expose you to new ideas and insights that will help you make your code more resistant to bugs.
Those are the correlations I came up with. What else you got?