Re: Managing multiple instances
- From: "Benjamin M. Stocks" <stocksb@xxxxxxxx>
- Date: 30 Apr 2006 11:35:47 -0700
Yes, falling apart would not surprise me. This is a real architectural
problem because the structure is being hard-wired into object
implementations. The proper OOA/D way to handle this is through
peer-to-peer relationships.
So even if the relationship is a "has-a" it should be implemented in
terms of collection rather than hard coding in a reference attribute?
All you then need is some way for the clients to know how to ask for a
specific instance of [C] and/or [A]. But you already have that problem
because the client needs to use the right hard-wired numbers. That
implies some context the client understands that can be mapped into
whatever new identity scheme you employ.
That is the crux of my whole problem, managing an identity when objects
being identified are attributes of other classes. There is more than
one instance of a class created in different context and keeping the
identity unique enough for client code to correctly request the
appropriate object from the data structure. I need something unqiue
that will not change if the rest of the system changes.
As it happens, an OOA/D model might look this way even for your existing
structure. The difference lies in the way the collections are
hard-wired now within objects vs. the separation of concerns for the
rules and policies of access, which should be in some other "factory"
object that manages instantiation of [A], [B], and [C] instances and
their relationships. The difference would also be reflected in the way
one navigates the relationships for collaboration.
So if I read this they way you intended, you are recommending a factory
or builder to do the initial creation of all objects rather than
allowing objects that contain other objects do the creation?
Thanks for your time,
Ben
.
- References:
- Managing multiple instances
- From: Benjamin M. Stocks
- Re: Managing multiple instances
- From: H. S. Lahman
- Managing multiple instances
- Prev by Date: Re: Managing multiple instances
- Next by Date: Re: Managing multiple instances
- Previous by thread: Re: Managing multiple instances
- Next by thread: Re: Managing multiple instances
- Index(es):
Relevant Pages
|