Re: What is good code?
Posted: Mar 30, 2005 8:09 PM
Good code is code you wouldn't mind...
- having someone know (or believe) is your own creation
Bad code is code that you...
- dread having to change
- cannot understand
- are embarassed to have your name on any of the CVS commits
The quality of the code is NOT the same as the quality of the product or the value of the product, a point often missed and blurred even within these posts.
I believe the measurement of quality is quite subjective, but there are certainly "best practices" and programmers with more and varied experience eventually adopt these one way or another.
Years in the profession do not always amount to experience, especially variety of experience, so you will often find the hardened solo guy whose code is a nightmare, but who would become indignant at the very notion that this could be so. In those cases, lead by example, value the person over the artifacts, and simply do your best to remember the difference between the code and the coder.
Best Practices develop almost in the same way as Patterns; they tend to be reactive solutions to problems previously encountered. As such, the goals of such practices reflect the goals of experienced, sometimes bored, developers. Thus, you find that many practices are aimed at reducing rework, complexity, even novelty, in some cases. These goals are not immediately relevant to novices or eager young developers, who can get very excited when "it works".
I encourage all developers to strive to gain a variety of experiences (working alone, in a small team, in a large team, working on short-term prpjects, long-term projects, on-offs, products, etc.) in a variety of roles using different languages and development tools. I also recommend that all developers keep an open mind about their own creations; fear not the refactoring! And finally, seek the opinions of others regarding these topics; standing on the shoulders of giants...