Design Patterns

BLOG V.

In this part of blog, im going to talk about design patterns. So what are the design patterns? we can say that are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. Despite the patterns give you the structure of your program it doesn’t mean that patterns give you the code for your program, hence we can say that patterns are high-level description of a solution.

Patterns consists of 4 elements:

  • Intent of the pattern briefly describes both the problem and the solution.
  • Motivation further explains the problem and the solution the pattern makes possible.
  • Structure of classes shows each part of the pattern and how they are related.
  • Code example in one of the popular programming languages makes it easier to grasp the idea behind the pattern.

But why do we need to know about design patterns? well, nowadays many programmers doesn’t even know a single pattern or they don’t even know if they are using a pattern or not, even though you don’t have any knowledge of it, you can become a good programmer, now let’s talk about the reason which you should learn it.

  • Design patterns are a toolkit of tried and tested solutions to common problems in software design. Even if you never encounter these problems, knowing patterns is still useful because it teaches you how to solve all sorts of problems using principles of object-oriented design.
  • Design patterns define a common language that you and your teammates can use to communicate more efficiently. You can say, “Oh, just use a Singleton for that,” and everyone will understand the idea behind your suggestion. No need to explain what a singleton is if you know the pattern and its name.

Design patterns can differ by their complexity. The most basic and low-level patterns are often called idioms. They usually apply only to a single programming language.

The most universal and high-level patterns are architectural patterns. Developers can implement these patterns in virtually any language. Unlike other patterns, they can be used to design the architecture of an entire application.

In addition, all patterns can be categorized by their intent, or purpose. This book covers three main groups of patterns:

  • Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code.
  • Structural patterns explain how to assemble objects and classes into larger structures, while keeping the structures flexible and efficient.
  • Behavioral patterns take care of effective communication and the assignment of responsibilities between objects.

Here is a video related to design patterns:

Here is a link for more information:

https://refactoring.guru/design-patterns

Dejar un comentario

Diseña un sitio como este con WordPress.com
Comenzar