K
K
Kirill Gorelov2019-08-13 09:13:52
Software design
Kirill Gorelov, 2019-08-13 09:13:52

Question about design patterns?

Guys, I'm reading about design patterns now, and because of the abundance of patterns, my eyes run wide.
And I'm a little confused.
The task is next.
In python, implement a notification system with initial support for sms, email, and then bots will be added and api will be connected, which pattern is better to use here. I'm leaning towards the decorator, but wanted to consult.
And in the same way, at the expense of the payment system, I would like to do the same through patterns. While thoughts only on a factory method.
Examples of patterns in python found https://github.com/pkolt/design_patterns

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dmitriy, 2019-08-13
@Kirill-Gorelov

Strategy

S
Sergey Tikhonov, 2019-08-13
@tumbler

I'm leaning towards the decorator, but wanted to consult.

Isn't this a criminal offence?
Patterns are essentially examples of a successful solution to a problem. You haven't had a problem yet. Write as it is written, problems will begin - you will go looking for solutions among the patterns.

A
Adamos, 2019-08-13
@Adamos

Here's the thing: patterns are ways of interacting classes, and not a method of writing the classes themselves.
If you write classes normally, observing SOLID, then it will not be a big problem for you to establish interaction between them using this or that pattern, and you will not need to rewrite the main code.
If you just fap on GoF and try to torture your ideas about how you understood them in the code, courageously overcoming OOP, you still get shitty code that will have to be rewritten several times for sane work. So at this stage the patterns are rather harmful.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question