mercredi 28 octobre 2015

Design of the engine in C++

I have to design a class with include many engine calculation (5 at max) for an object A. How to design properly, so new engines can be added.

Class Base: Calculate which uses one of the Engine.

Engine: get xdata and gives double ydata. method: initialize, calibration, calculate,...

Can I do a a switch (simpler, not heavy) in Calculate ?

switch (engineID)
1: Use Engine1
2: Use Engine2
....

I dont want to create a derived class for each engine, since this is mainly C code calculation (numerical algo).

I think this is very common issue in design: making simple or adding new classes....

Aucun commentaire:

Enregistrer un commentaire