Re: how to organize several class and their instance in windows programming
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio
news:tg9e349fvatfknqpf9a90a5or3a2vj3uqb@4ax.com...
I think the REAL problem is that you are answering the question he asked,
instead of
answering the question he SHOULD have asked, which is "does this
organization make any
sense?".
I think that I don't have enough elements to judge if the OP's design is
good or not...
Yes, I was just trying to answer his original question, proposing a possible
solution in C++.
Note that in my post I did not write about CMainFrame, etc.
I "abstracted" from that, and I suggested to put the OP's "component"
classes (CMotionControl, CImageProc, etc.) into a common "container" (I
called that CSystemCore), instead of putting everything in CMainFrame.
I don't know if for OP's design CSystemCore should be a singleton, or
something related to a particular document, or something different...
I think that to understand these things one need to communicate with the
designers, understand the problem, the requirements, the analysis...
As soon as
classes start getting complicated pointer schemes, it's probably a serious
design error.
I agree that the KISS (Keep It Simple Stupid - or something like this...)
rule is a good rule to follow. And I do agree that the simpler the design,
the better.
However, again, I don't know details of OP's original problem, so I assume
that he simply wanted to do that (kind of several classes that need pointers
to each others).
I think the effort should concentrate on a good design, not some minor and
trivial detail
of pointer management.
100% agree that design is *number one* thing. Implementation and coding come
after design.
I just assumed the OP's design as an input "fixed" datum, kind of a
constraint, and tried to propose a solution in C++.
Giovanni