Author Avatar

Pradeep Mishra

1

Share post:

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

The concept of design patterns has been criticized by some in the field of computer science. Let’s take a look at the most typical arguments against using patterns.

Kludges for a weak programming language 

Usually, the need for patterns arises when people choose a programming language or a technology that lacks the necessary level of abstraction. In this case, patterns become a kludge that gives the language much-needed super-abilities.

For example, the Strategy pattern can be implemented with a simple anonymous (lambda) function in most modern programming languages.

Leads to inefficient solutions

The idea of a design pattern is an attempt to standardize what are already accepted best practices. In principle, this might appear to be beneficial, but in practice, it often results in the unnecessary duplication of code. It is almost always a more efficient solution to use a well-factored implementation rather than a “just barely good enough” design pattern.

Unjustified use

If all you have is a hammer, everything looks like a nail.

This is the problem that haunts many novices who have just familiarized themselves with patterns. Having learned about patterns, they try to apply them everywhere, even in situations where simpler code would do just fine.

A pattern is not a defined and immutable solution. A pattern is by no means an implementation. A pattern is a way out of a problem. A pattern explains how to overcome common hurdles you’ll find on your path. Don’t let patterns guide you. Don’t see your current problems from a pattern perspective. Don’t seek to transform your problem so it fits your pet pattern, or you’ll end up writing mediocre solutions to problems you didn’t even have.

I hope you have enjoyed this post. Please like and share and feel free to comment if you have any suggestions or feedback.

Elasticsearch : What, How and Why?
Apache Hive 3 Changes in CDP Upgrade: Part-1

Discussion

Leave a Reply to MandeepCancel reply