coupling child/parent classes
From: Pamela G. (antispamid2003_at_yahoo.com)
Date: 03/31/04
- Next message: Cy Coe: "Re: xp and simple design"
- Previous message: Bruno Desthuilliers: "Re: Call for some decency in posts"
- Next in thread: Robert C. Martin: "Re: coupling child/parent classes"
- Reply: Robert C. Martin: "Re: coupling child/parent classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2004 14:50:29 -0800
Hi,
I am in the process of designing a GUI application using wxWidgets's
doc/view framework (formerly wxWindows: http://www.wxwidgets.org).
The coupling between the various components in the doc/view framework
is pretty strong - they *all* need each other, a problem that has been
solved by placing all these classes in one file...
I am trying however to design my application in such a way that there
is minimum coupling/knowledge between *my* classes (some are derived
from the framework's classes), despite the interdependencies inside
the framework.
For example, up until this stage I succeeded in creating a view class
and a parent frame class (the frame is said to contain the view), in
which the frame "knows" about the view, but the view doesn't know
about the frame.
I like this simple "containment" relationship :)
However, while trying to implement some more complex functionality in
the application, I ran into a situation were the view needs to know
about the frame. That is, a #include <frame> in the view.cpp module.
(note: I have no cyclic #include's in header files. I am mainly
interested in the conceptual/principal aspect of the design - with
practical maintainability/extensibility implications, of course)
Since I am not that experienced in the world of design models and
patterns, I would like to ask the gurus among you: Is this kind of
inter-dependency ("inter-knowledge") acceptable in a good OOD
application design?
I know that *ideally* no software component should need any other
software component, but we all know about the model/view/controller
pattern in which you can't use one class/module without requiring the
other two. Why can't I apply this principle to to the view/frame
modules?
I am curious to learn about other people's experience, whether you ran
into a similar situation and what was your approach/solution.
Thanks in advance,
Pam
- Next message: Cy Coe: "Re: xp and simple design"
- Previous message: Bruno Desthuilliers: "Re: Call for some decency in posts"
- Next in thread: Robert C. Martin: "Re: coupling child/parent classes"
- Reply: Robert C. Martin: "Re: coupling child/parent classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|