Design Patterns

Imagine that you are a blacksmith from the middle ages and you are asked to craft many similar swords. I don’t know the process to create a sword but one thing for sure is that it will be tedious to build the “skeleton” of the sword many times. So one thing you do, is to create a mold which let you craft a standard sword easier and then you can work over it according to the customer specification.

Software design patterns is very similar to a mold, is like a template that provides a solution and that can be used many times in general problems.

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design.

                                                From source making

Design patterns it is not a finished design that let you work directly to the code, is more like a quick start guide that helps you in how to solve general problems, also, it should be implementable in most program language and non in a specific one. That’s why I say that is like a quick start guide, because you solve the problem with your own tools and knowledge, and the design pattern only tells you how to attack the problem or how to start the first move. But if the design pattern is implemented in the wrong place, your software is not going to work and will create more problems, making it unable to come with a solution.

4346978966_7199ac50ac_z
flickr photo by BodHack https://flickr.com/photos/bodhack/4346978966 shared under a Creative Commons (BY-NC) license

Patterns were originated as an arquitectural concept by Christopher Alexander, and it was introduced in programming in the OOPSLA conference in 1987 by Kent Beck and Ward Cunningham. Then it gained popularity in computer science when the Gang of Four

wrote about it in a book called “Design Patterns: Elements of Reusable Object-Oriented Programming” that was published in 1994.

There are many software design patterns, so I will not explain them all, instead I’m writing their classifications which are: structural, creational and behavioral.

Structural patterns generally deal with relationships between entities, making it easier for these entities to work together.

Creational patterns provide instantiation mechanisms, making it easier to create objects in a way that suits the situation.

Behavioral patterns are used in communications between entities and make it easier and more flexible for these entities to communicate

From COde Tutsplus

Reference:

https://sourcemaking.com/design_patterns

http://code.tutsplus.com/articles/a-beginners-guide-to-design-patterns–net-12752