<BackIntroduction to Design Patterns in Software Development
10/3/2022In the process of development, inevitably, there are repetitive architectural solutions. There are two ways to work with such solutions:
- 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.
- 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:
- 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.
- 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.
- 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.
- 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:
- 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.
- 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.
- 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.
Lates
About graphs, simply.
12/18/2022In 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.
What is the difference between outsourcing development and outstaffing an IT employee for development?
10/17/2022In this article we will understand what outsourcing and outstaff development are.
Meet the Pentest
8/22/2022We are beginning to consider one of the main methods of assessing the security of computer systems and networks for potential vulnerabilities - penetration testing
Reducing the implementation period of MVP
12/8/2022Let's figure out the timing of the implementation of the MVP.
Testing an MVP concept
1/9/2023We will figure out how not to waste the budget on MVP development in vain
Incorrect estimation of the cost of IT contractor services
9/10/2022Today 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.
OSI Model Levels
9/6/2022In this article, we will take a closer look at each of the levels of the OSI model
Documenting code in the Rust programming language
8/24/2022In this article, we will look at how documentation takes place in Rust and consider a very useful opportunity - writing tests through documentation.
Introduction to the OSI model
8/19/2022In this article we begin to consider the fundamental model of network interaction - OSI
CSS animation ripple
8/31/2022A simple example of how to implement ripple animation using HTML and CSS
From concept to MVP
11/18/2022In 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
Introduction to writing the terms of references
1/31/2023The Terms of Reference are an important part of the development process. In this article, we will begin to dive into this issue.
Introduction to software development
10/10/2022Today, 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.
From idea to concept
10/27/2022In this publication, we will talk about how the idea differs from the concept. Let's do this with an example of a specific goal
Weighted graphs
12/26/2022In this article, we will get acquainted with weighted graphs, Dijkstra's algorithm, and its implementation in the Rust programming language.
Why does a VPN business need?
9/27/2022In this article, we will look at how you can secure access to enterprise cloud resources using a VPN