So I am creating a numerical solver that I want to use for many problems/algorithms. The way that it's written, there is a generic class called "Algorithm_Scheme" (and associated files Algorithm_Scheme.h and Algorithm_Scheme.cpp) that is included as a member of the "Solver" class.
To create an executable for a different problem/ algorithm, I replace the text "Algorithm_Scheme" with the name of specific schemes that I've created. E.g. "Logistic_Regression_Scheme", "Linear_Regression_Scheme", etc. This way I can create different executable for each problem/ algorithm. Is there a better way of doing this? Should I define a macro? So for instance:
#define Algorithm_Scheme Logistic_Regression_Scheme
in order to create the different executables? An issue is that I will have to change the #include's to only include the Algorithm_Scheme header that I want... What are your thoughts? I'm just doing the first thing that comes to my head. I don't know what best practices would be.
Algorithm_Scheme
? – Ben Cottrell Mar 4 '17 at 23:28define
macros? I think you need polymorphism, strategy pattern and dependency injection. – Q Q Mar 5 '17 at 19:24