R
R
Roman Yakimchuk2019-09-11 13:15:55
Software design
Roman Yakimchuk, 2019-09-11 13:15:55

What are the recipes for using patterns?

Hello everyone,
I have been developing software for a long time, and no matter who I work with, from novice developers to architects (not Vasya the architect, but from a large company), everyone works on the principle of nailing, and then when it is necessary to develop the system, We'll come up with something.
I don’t like this approach very much, and I see the solution of problems in the patterns, and most importantly, they allow you to postpone the solution of the problem to the very end, i.e. you can create a system, and then integrate the desired solution into it.
In fact, it turns out a little different. If you try to design a system at the level of patterns, you get a good solution (i.e., you can painlessly change the system, develop, maintain, and so on), but the result is a solution that is far from the KISS principle, i.e. instead of a simple solution, you get a flexible monster that tells you "I'm flexible, I'm good", but the number of entities makes the system complex and confusing.
I read what people write, but opinions are different, from "do not use patterns, it will be worse" to "use them always", and there is someone in the middle, "write first without patterns, and then simplify the system by implementing them."
So what are your recipes for using patterns, when do you use them, and why?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Adamos, 2019-09-11
@yakimchuk-ry

Here's the recipe: use patterns when you think you can use them, and don't be afraid to throw out bad code just because the patterns are beautifully used.
Gradually come to understand when to apply them and how.
You just can't get that understanding from books.

S
sim3x, 2019-09-11
@sim3x

I have been in software development for a long time.

According to the phrase
and I see in patterns the solution to problems
no. You have not yet had the disease of a joon reading a book with patterns
The right approach
everyone works on the principle of nailing it, and then when we need to develop the system, we'll come up with something.

If you try to design a system at the level of patterns, you get a good solution.
no. It turns out a solution assembled from patterns, and not a solution to the problem
opinions are different, from "do not use patterns, it will be worse" to "use them always", and there is someone in the middle, "write first without patterns, and then simplify the system by implementing them."
All three are incorrect
Write code that solves problems. If possible, scalable, loosely connected, etc.
The main concern is the solution of the task
. And you can talk about patterns at the conference

A
AleksDesker, 2019-11-28
@AleksDesker

Единственный способ не использовать паттерны, это не писать код. Паттерн это общие механизмы решения задач, встречающихся в программировании, без привязки к синтаксису языка. Если кто-то работает со сложными проектами и при этом говорит что он не использует паттерны - это значит лишь, что он не понимает что такое паттерн или просто не знает названия паттернов, которые он использует. Изучать их я бы рекомендовал в несколько подходов - сначала просто почитать что-то популярное для общего развития, надеясь, что нечто отложится в подсознании. Второй шаг стоит сделать после пары лет работы со сложными проектами и\или фреймворками - читаете, пытаясь понять какие паттерны вы используете сами, какие паттерны используются в вашем любимом фреймворке и т.п., изучаете все их нюансы и разновидности, приучаете себя \ свою команду использовать названия паттернов, вместо пространных описаний где это возможно. Только после познания дзена в первых двух шагах стоит переходить к третьему - изучение незнакомых, непонятных паттернов, при этом вы пытаетесь понять в каком из прошлых проектов этот паттерн мог бы быть применен и какие преимущества он дает по сравнению с решением которое было там. Знание и понимание паттернов позволяет сделать систему настолько простой насколько это возможно, если у вас попытка применения паттернов приводит к появлению лишних сущностей - скорее всего вы просто поторопились с шагом 3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question