This chapter will cover the following topics:
- Introduction to code smells
- The concept of clean code
- How agile and clean code practices are related
- SOLID design principle
- Code refactoring
- Refactoring code smells into clean code
- Refactoring code smells into design patterns
Clean code is the source code that works in an accurate way functionally and is structurally well written. Through thorough testing, we can ensure the code is functionally correct. We can improve code quality via code self-review, peer code review, code analysis, and most importantly, by code refactoring.
The following are some of the qualities of clean code:
- Easy to understand
- Easy to enhance
- Adding new functionality doesn't require many code changes
- Easy to reuse
- Self-explanatory
- Has comments when necessary
Lastly, the best part about writing clean code is that both the development team involved in the project or product and the customer will be happy.