I'm developing a C + + application with the following architecture :
- several POD structures: POD_type_A, POD_type_B, POD_type_C, ...
- a class DynamicModel with only functional/processing methods that implement the application logic ; until now, this class does not contain any attribute, and I would like to preserve it like that,
- a graphical user interface for setting the POD attributes and call the DynamicModel methods.
By now, I realize that many POD_type_A attributes are calculated from other POD_type_A attributes. Thus, the calculated attributes shouldn't be set through the GUI, and they shouldn't be defined in POD_type_A class neither. I have the same problem for other POD types. But where could I define these calculated attributes?
I see two solutions:
- Calculate and store these attributes in the DynamicModel class, but then it would increase DynamicModel complexity,
- OR try to apply the "adapter" pattern. If I well understood, this pattern aims to convert the interface of a class to another one. In my case, if I consider that POD_type_A interface permits to access POD_type_A attributes, then the POD_type_A_Adapter interface should permit both POD_type_A and calculated attributes access. Thus, a POD_type_A_Adapter instance would be composed from a POD_type_A.
I'm quite inexperienced in designing applications. Thus I'm maybe completely wrong.
What would you recommend me?
Thank you in advance for your help.