Should we mention that we are using a design pattern in our code?
If the design is good and the code is clean, it should speak for itself. It is not recommended that you name things after the design patterns you are using for a couple of reasons:
- Users of our code and other developers don't need to know the design pattern behind the code, as long as it works as intended.
- Stating the design pattern ruins the intention revealing principle. Adding the name of the design pattern to a class makes it lose part of its original meaning. If a class represents a query, it should be named Query or EnhancedQuery, something that reveals the intention of what that object is supposed to do. EnhancedQueryDecorator doesn't mean anything ...