Using static factories to create two objects with bidirectional linking



I seem to have trouble building a static factory due to the need to
build a two-way association:

Right now I'm making some kind of manager class, which, for a static
factory, takes two maps: one <A, B> and the other <B, C>. The manager
manages two types of objects: one is a wrapper for A (call it A'), and
the other is a wrapper for B (call it B'). A and A' have a one-to-one
relationship, as does B and B'. The manager has a one-to-many
relationship with A' and B'. (The two input maps are intended to be
discarded after the manager is built - for example, A and B are
"primitive input" like strings)

One issue is the need for a two-way relationship: A's and B's are
associated with their manager, so in order to create the A' for an A
the manager must first exist. But for the manager to exist it needs
all of the A's. This is a chicken-and-egg problem that I am unsure of
how to solve: If X and Y are two classes that are one-to-one with each
other, and an X and Y object are associated with each other, then
clearly both objects must be created at the same time. However, this
can only be done if one object was partially built, the other object
was built and linked to the partial object, and the partial object was
completed - which would imply that on one end there would be a public
interface to change the one-to-one association (making said
association no-longer one-to-one). How, then do I do this so that
this does not happen?

The other issue is in the construction of A' and B': beyond wrapping A
and B, I'd like them to have functionality that takes advantage of the
map - in A' I'd like to get the B's associated with it (determined
from whether the A is associated with the B), while in B' I'd like to
test whether an A is associated with this B' (which is done, of
course, through the manager link) and get the C associated with the
B' (determined from what C the original B is associated with). The
issue lies in how this is done, which I am stuck on.

How do I design out of this hole...?

.



Relevant Pages

  • RE: Quota Alternative
    ... Manny is correct here. ... Volume Manager, but it does not have any additional functionality than the ... built in MS one has. ... >> management of quotas? ...
    (microsoft.public.windows.server.general)
  • Re: Sales Offer Summary Database
    ... I do have the tables built - however Ken implied not to use tables when I ... See where my confusion comes in? ... All tables will be linked to a Commercial Manager ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Telescopes in the Movies
    ... for a manager who worked for me but lives quite a ways away. ... Their big hobby was breeding arabian horses on a 5 acre spread 40 miles east of L.A. He also built and flew model helicopters. ...
    (sci.astro.amateur)
  • Re: teaching a child - console or GUI
    ... > Which is why I developed the simplified memory manager... ... using window's built ... > in smarts instead of trying to second guess it. ...
    (comp.lang.pascal.delphi.misc)