Transfering data between objects
From: Cobus Kruger (spamwontwork_at_kplanet.co.za)
Date: 12/08/04
- Previous message: Dagfinn Reiersol: "Re: agile/xp question (formal analysis)"
- Next in thread: Donald F. McLean: "Re: Transfering data between objects"
- Reply: Donald F. McLean: "Re: Transfering data between objects"
- Reply: H. S. Lahman: "Re: Transfering data between objects"
- Reply: Robert C. Martin: "Re: Transfering data between objects"
- Reply: Dagfinn Reiersol: "Re: Transfering data between objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Dec 2004 23:22:29 -0800
Hi Guys,
I am again struggling with a recurring problem that I am sure there
must be a pattern for.
I have a two hierarchies of classes. One of them is a hierarchy of
business objects and the other is a hierarchy of screens to
display/modify those objects. In both cases, an abstract base class
allows me to polymorphically call things like load, post and validate.
Screens know bits and pieces of the business objects they represent,
but mostly the screens and business objects are associated dynamically.
This worked well. Until I received requirements for new validations on
the screens. Some of these new validations require that the screen know
a little about an object not already associated with it. That bit makes
me a little uncomfortable, but it isn't real problematic.
Unfortunately, the object that is now needed is bound to another
screen, and the attributes required may not have been posted to the
object yet - that only happens behind an OK button. This implies that
my one screen needs to be coupled to another screen. Ouch.
In other instances that I have had problems passing data between
objects that must remain uncoupled, I have defined a data packet that
can be published. Each object can then access the datapacket (various
levels of control may be in place but is irrelevant to the basic
concept). This also works well enough, but sometimes mean that the
packet becomes like a really large global store that constantly needs
to have certain fields synchronized.
There must be a better way, I'm sure. How do I pass data between two
objects that are and should remain decoupled?
Regards,
Cobus
- Previous message: Dagfinn Reiersol: "Re: agile/xp question (formal analysis)"
- Next in thread: Donald F. McLean: "Re: Transfering data between objects"
- Reply: Donald F. McLean: "Re: Transfering data between objects"
- Reply: H. S. Lahman: "Re: Transfering data between objects"
- Reply: Robert C. Martin: "Re: Transfering data between objects"
- Reply: Dagfinn Reiersol: "Re: Transfering data between objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]