<Back
Introduction to Design Patterns in Software Development

In the process of development, inevitably, there are repetitive architectural solutions. There are two ways to work with such solutions:

  1. Accept and duplicate them in the code. This will make your code unreadable, which is not the worst thing. Imagine that you have a hundred code files into which you have copied some repetitive code. It turned out that there was an error in this piece of copied code. Now you have to make edits to each of the hundred files - that's scary.
  2. Use one of the design patterns. This will structure the code and help get rid of redundancy in the architecture.


In order not to invent a definition, I will quote it from Wikipedia:

A design pattern in software development is a repeatable architectural design that represents a solution to a design problem within some frequently occurring context.


Many design patterns are based on the principles of OOP, so I will remind you of these principles.


Let's turn to the Wiki again:

Object-oriented programming is a programming methodology based on the representation of a program as a set of interacting objects, each of which is an instance of a certain class, and classes form an inheritance hierarchy.


The following principles of OOP are distinguished:

  1. Abstraction. We are a class of people and we have nails, this is a common important property. Someone has painted nails, and someone does not - this is an unimportant property, it is omitted in abstraction. The abstraction principle is responsible for separating significant properties and methods into a separate class, omitting insignificant ones.
  2. Encapsulation. Imagine that we are describing a class responsible for the movement of the hand. It has a public method - move_hand, which is available for calling from other classes. Other methods are associated with the movement of the hand, such as moving the joint or the velocity of the neuropulse, which cannot be changed, otherwise the hand will not move. We make them private, inaccessible to public calls and successfully avoid changes. The essence of encapsulation is the ability to hide properties and methods, providing a public interface for interacting with the class.
  3. Inheritance. We are all derived from our parents. We inherited some basic properties from them, but at the same time we regularly expand them, forming a new class, for example, in the learning process. The essence of inheritance is the ability to create a child class from the parent, which can take over its properties and methods, expand or redefine them.
  4. Polymorphism. Before creating a car, we define common properties and capabilities for it: to drive, brake, engine, wheels. All these properties are different for different types of machines. Polymorphism allows you to define one common interface for objects with different implementations.


The main classifications of design patterns are distinguished:

  1. Generative patterns allow you to optimize the process of creating objects through the creation of abstract interfaces. Basic templates: Abstract Factory, Factory, Builder, Singleton, Prototype, and others.
  2. Structural patterns form complex structures that expand the capabilities of one or more objects. The main templates are: Adapter, Bridge, Composite, Decorator, Facade, Proxy, and others.
  3. Behavioral patterns allow you to improve the quality of interaction between objects. The main templates are: Chain of responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, and others.


There are a lot of design patterns, but among them there are those that are more common than others. Here we will begin to consider them in the following articles.

Hashtags:
#designpatterns
Share:

Lates

About graphs, simply.

In this article, we will begin our acquaintance with graphs, get acquainted with the breadth-first search algorithm (BFS) and implement the graph in the Rust programming language.

#graphs
#rust
#algorithms

What is the difference between outsourcing development and outstaffing an IT employee for development?

In this article we will understand what outsourcing and outstaff development are.

#developmentprocess

Meet the Pentest

We are beginning to consider one of the main methods of assessing the security of computer systems and networks for potential vulnerabilities - penetration testing

#pentest

Reducing the implementation period of MVP

Let's figure out the timing of the implementation of the MVP.

#developmentprocess

Testing an MVP concept

We will figure out how not to waste the budget on MVP development in vain

#developmentprocess

Incorrect estimation of the cost of IT contractor services

Today we will talk about the incorrect assessment of the cost of developing IT solutions. This pain is one of the main ones for enterprises and startups, including IT contractors themselves.

#consultin

OSI Model Levels

In this article, we will take a closer look at each of the levels of the OSI model

#networks
#osi

Documenting code in the Rust programming language

In this article, we will look at how documentation takes place in Rust and consider a very useful opportunity - writing tests through documentation.

#rust

Introduction to the OSI model

In this article we begin to consider the fundamental model of network interaction - OSI

#networks

CSS animation ripple

A simple example of how to implement ripple animation using HTML and CSS

#css

From concept to MVP

In this article, you will learn, by example, how to move from a concept to an MVP without unnecessary complications in the functionality of the product

#developmentprocess

Introduction to writing the terms of references

The Terms of Reference are an important part of the development process. In this article, we will begin to dive into this issue.

#developmentprocess

Introduction to software development

Today, most companies are faced with IT development and often do not get what they want. In this article, we begin to dive into the process of creating IT solutions.

#developmentprocess

From idea to concept

In this publication, we will talk about how the idea differs from the concept. Let's do this with an example of a specific goal

#developmentprocess

Weighted graphs

In this article, we will get acquainted with weighted graphs, Dijkstra's algorithm, and its implementation in the Rust programming language.

#algorithms
#graphs

Why does a VPN business need?

In this article, we will look at how you can secure access to enterprise cloud resources using a VPN

#networks
#vpn