Design Patterns Can Be Very Evil

Posted on 15.03.2015 by Kim N. Lesmer.
Design Patterns - Elements of Reusable Object Oriented Software, is a software engineering book which describes recurring solutions to common problems in software design. The book has been very influential to the field of software engineering and it is viewed upon as an important source for object-oriented design theory and practice. The authors are often referred to as the Gang of Four (GoF).

Why is it that in the world of academics, and in the computer engineering part specifically, so many people become religiously obsessed, rather fanatical, with ideas and theories?

Such people cause damage to the benefit and development of mankind and they belong in the Dark Ages!

In the community of the PHP programming language these people crawl and creep in all the major forums, chat rooms and websites spreading misguidance, stupidity and ignorance.

If we regard the book about design patterns as not related to software engineering, but related to the day-to-day life of all people, and if we went back in time to the Stone Age, and the same kind of religious nut jobs existed, mankind would have been grinned to a complete halt. We would still be using sticks and stone!

Maybe it is because of the nature of academic circles, they are just academic. In the real world when practice beats theory, religious nut jobs are mostly frowned upon.

This presents us with an important task at hand because the entire educational system is hopelessly outdated! It no longer produces independent and innovative thinking, rather it produces grate rated clones without brains, people who have mainly learned nothing but theory. When such people have finished their long studies they all have to be reeducated in the real world.

In Denmark most education is free, but it still follows the same hopelessly outdated way of teaching, and I cannot but feel sorry for people in countries that pay thousands of dollars in order to get an education only to end up having learned nothing but useless theory.

Regarding the subject at hand, namely design patterns, then all design patterns should be used with extreme care.

What's important to understand is that when we think "common problem" and we start to think "common solution", we totally skip out on creativity and innovation!

Rather than teaching people to be innovative we simple teach people to become search engines!

No, no, don't try to solve that problem yourself you idiot! Use a design pattern!

-- Some religious nutjob.

I know for a fact that these problems was never the intention of the GoF! They thought about preventing reoccurring problems in software design, and they have some great ideas that works both in theory and in practice.

However, the concept of "a pattern" is very dangerous and in the hands of religious nut jobs it's devastating.

In the real world of software engineering, patterns often leads to complication and cumbersome maintenance, especially when overused. Most of the time there is a really simple and creative solution, but if people are religiously possessed by design patterns, they never find it.

Rather than focusing on design patterns, focus should be on creativity, innovation, and good principles.

There exists a multitude of design principles and a good part of those are also described in the first chapter of the "Design Patterns" book by the GoF.

Program to an 'interface', not an 'implementation'. (Gang of Four 1995:18).

Favor 'object composition' over 'class inheritance'. (Gang of Four 1995:20).

Other great design principles are:

  • Keep, It Simple, Stupid (KISS)
  • Always use the right tool for the job"

And:

  • Single Responsibility Principle.
  • Open Closed Principle.
  • Liskov Substitution Principle.
  • Interface Segregation Principle.
  • Dependency Inversion Principle.

Some of these principles overlap each other, but generally presents a great way of designing software.

These principles don't prevent you from thinking innovative, rather on the contrary.

Paul Weaton, a SUN certified Java programmer, has a great short article about Evil Design Patterns that's worth reading.

I think patterns started off as generally recognized best solutions for common problems. But now that they have been around for a while and we have experienced applications being made ten times more complicated than they need to be because people try to cram in all the patterns that they have read about (my application is well architected, because it is loaded to the gills with patterns) my impression of the value of the pattern has shifted a bit.

-- Paul Weaton

One way to know if you're dealing with an experienced programmer is that such a person is never religious, rather he or she is "pragmatic"!

Being pragmatic means that you deal with things sensible and realistically in a way that is based on practical rather than theoretical solutions.

The companies looking to hire programmers will notice (or maybe they won't because they too are trapped in hopelessly out of date ways of hiring people?) that many self-taught developers are doing great and revolutionary stuff out there by thinking completely out of the box.

So if you represents a company looking to hire someone maybe you shouldn't be so ignorantly focused on education and grates!?

Most programming job adds in Danish job websites are filled with sky-high demands of education this or education that. This is another huge relic from the past that seriously needs to be changed!

Some of the greatest programmers in the world, even some of the most successful business people, are self-taught.

People who do what they do because they love what they do, they are the most important people to have in a company, even if such a person has no educational background worth mentioning.

We have to stop putting people into boxes and we have to stop thinking like clones and flocks of sheep!

If you have any comments or corrections feel free to email them to me.