Half the battle in programming clean code is in the correct implementation and usage of design patterns. Design patterns themselves can become code smells. A design pattern becomes a code smell when it is used to over-engineer something that is rather simple to implement.
You have already seen the use of design patterns in writing clean code and refactoring code smells in the previous chapters of this book. Specifically, we have implemented the adapter pattern, the decorator pattern, and the proxy pattern. These patterns were implemented in the right way to accomplish the task at hand. They were kept simple and they most certainly did not complicate the code. So, when used for their proper purpose, design patterns are really useful in removing code smells, thus leaving your code nice, clean, and fresh.
In this chapter, we will address the Gang of Four (GoF...