Development Hygiene - a Definition
Hygienics is often defined as a science that deals with the preservation of health. Even though we deal with hygiene in a rather different context than software, the concept translates well to here as well. Healthy codebase is a happy codebase.
Consider that you are just about to start working on a maintenance project and need to set everything up to get the thing run on your development environment. You'll likely need to fetch and possibly build a bunch of dependencies, perhaps set up a virtual environment even. If you are unlucky, it might take a while to get all of this done.
This is actually one way how hygiene shows up in practice. If the project has been set up properly, you probably won't have much trouble getting to speed with development. One solution to this problem is simply to package the whole development environment in a ready made snapshot that you can simply run.
Just getting the project run and build isn't enough. Next you'll probably need to some real work. Time to open up the maintenance hatches and dive in. What you'll find can vary quite a bit. With some luck you might have some documentation available. Otherwise you might need to poke around a little and see what does what. Eventually you'll get around the codebase and will be able to contribute to it.
Besides documentation there might be some scaffolding, ie. tests, that describe boundaries of the system to some extent. This kind of scaffolding makes it harder to break things accidentally. If you are unlucky, there might not be any or the ones that are there are faulty somehow or simply won't run. In order to learn how the code is supposed to work it might not be a bad idea to write a few tests to assert your hunches. These will likely become beneficial later on.
Sometimes documentation might be somewhat non-existent as well. In this case it isn't a bad idea to jot down some notes. You'll thank yourself the next time you'll need to touch that steaming pile of ... code.
One of the first things you'll notice while delving into a new codebase is style, or lack of it. The way the code is written tells a lot about its writer and the project even. If you are seeing a lot of defensive coding around, you can bet there isn't a lot of trust in the organization. Huge swaths of comments probably imply that there is some kind of a bureaucracy in place. It's not that comments are bad, there's a certain limit, though.
Why Development Hygiene is Important?
Often we just write code in a hurry and hope it works. As I mentioned in a previous post of mine, developing fast isn't necessarily the fastest way to get things done. Even though you might be or feel fast for a brief period of time, the reality will sooner or later catch up with you.
Maintaining proper development hygiene makes it easier to go faster. Quality is fractal. If you can keep the quality of a codebase high, you'll likely be able to go faster longer term. It is alright to do some quick hack jobs at time just to see if something would work, you'll need to remember to clean up later, though.
As postulated earlier you or your successor will bump into hygiene once he needs to maintain the work you've done. I believe maintaining a proper hygiene is one of the key ways in which we can make software maintenance cheaper.
I hope this post gave you some idea why I believe software hygiene is important. It is alright to write trash at times as long as you are aware of it and don't make that a habit. In the realm of software sometimes the best way to attain knowledge is to write some code just to throw it away. If you want your software to be maintainable and fun to work with long term, keep software hygiene in mind, however.