Java programming language logo

Design Patterns

Design patterns give solutions for common problems in object-oriented software development. They help developers to apply common solutions and best practices in their design and avoid pitfalls. With the help of them, software becomes more flexible, extendable and maintainable.

Gang of Four (GoF)

In 1994, a book was published called Design Patterns: Elements of Reusable Object-Oriented Software. It was written by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. This book describes 23 design patterns and made a huge impact to software development. Since then, it is the main source of object-oriented design and best practices. The four authors of the book are referred as the Gang of Four or GoF.


Professional object-oriented software developers have to be familiar with the design patterns. In addition to their advantages mentioned above, design patterns have another important role. They provide common terms for software developers.

Without the design patterns, when a programmer wants to talk about his or her software, it takes a lot of efforts to explain what those objects do and how. With the design patterns, the same thing is just a few words, like this is an observer pattern and that uses decorator pattern. A pro presenter takes for granted those are enough information.

Do not overuse

Design patterns help to improve our software, but they can also add some complexities to our design. Many design patterns result in more classes and apply not so obvious call hierarchies. Overuse of the design patterns can lead to a more complicated software, which cannot be a goal. Design patterns should be applied when they are needed in well known situations, but never should be forced into our software design.

Types of Design Patterns

The Gang of Four grouped the design patterns into three categories: Creational, Structural and Behavioral patterns.

Creational patterns give solutions for object instantiation. They encapsulate the instantiation logic and produce one or more object instances in different ways.

Structural patterns deal with object composition. They give solutions for composing classes into structures while keeping the design flexible.

Behavioral patterns deal with communication between objects and delegation of responsibilities.