Keeping the Code Clean
- "Dirty" Code Is Evil - or at Least Unprofessional
- A Simple Example
- Let's Try That Again
- Now We Need a Helper
- It Works, But It Sure Isn't Pretty
- How This Technique Helps
"Dirty" Code Is Evil - or at Least Unprofessional
Keeping your code clean is just as important as getting it to work. Clean code allows you to extend and maintain your modules, whereas dirty code ties you in knots. I can't stress this enough: Software professionals don't leave their code in an unclean state. They don't tolerate sloppiness, wanton duplication, or messiness. Professionals take pride not only in getting their code to work, but also in keeping it simple, small, and easy to read.
Keeping code clean is one of the central goals of Agile methods such as extreme programming (XP). These methods describe a set of practices that promote the production of high-quality codepractices that include test-driven development (TDD) and refactoring. This article takes a look at how these two practices help keep a module clean.