Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should one be strict on design pattern implementation?

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?

like image 874
Matthias van der Vlies Avatar asked Nov 29 '22 05:11

Matthias van der Vlies


1 Answers

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.

like image 52
Mike Hofer Avatar answered May 23 '23 05:05

Mike Hofer