Answer the question
In order to leave comments, you need to log in
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
I'm leaning towards the decorator, but wanted to consult.
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 questionAsk a Question
731 491 924 answers to any question