Rewrite code to use the design pattern "Factory" #3
SteffanWullems
started this conversation in
Ideas
Replies: 1 comment
-
We are slowly moving towards a functional programming design rather than an object oriented one. In that model, the core engine becomes no more than a runner and all relevant data is stored in individual data structures. Independently, the actual functions can be provided to the engine. This factory model fits that design and would be the last step in the refactoring. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently i started looking at the code. I saw a lot of conditions and functions directly related to an calculation. To make de code more maintainable and easier to add functions i think the design pattern "Factory" would be a good option.
The way i see it is that we have a common interface(python: protocol) like (sample)
Sorry its python and if there are errors in this sample. It's been a while i done this in C++ but it is the same principle.
This way you will repeat the same code if you use python. In C++ i would use a base class with 2 pure virtual functions so small common code blocks can be reused or not skipped.
This is my opener and it needs more work. Please let me know your opinions and feedback.
Beta Was this translation helpful? Give feedback.
All reactions