I’m currently reading, ‘Design Patterns:Elements of Reusable Object-Oriented Software’ by Erich Gamma and others. I decided to do some small projects to see the actual result of applying design patterns to the software I write.
How strict should I be on implementing them? I have seen some examples on the internet that implement the interpreter pattern which just skip entire classes/interfaces/methods in the implementation. Should one be allowed to do the same or is it better to be strict about the implementation to avoid future problems, i.e. to pre-support functionality? Or are design patterns not to be seen as the answer to everything and should they be applied in a way that applies to the current situation, i.e. code specific?
There is no silver bullet. A design pattern is a guideline, a formula for reusable designs that have worked for others in the past for achieving a solution to a common problem. However, if there are parts of that pattern that would unnecessarily complicate your software, it’s not entirely necessary that you use it.
A design pattern’s goal is to simplify and streamline your design. If it doesn’t do that, it’s not worth using.
Others may have differing opinions.