PicoContainer
  1. PicoContainer
  2. PICO-93

Remove many-to-many parent-children relationship

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-5
    • Fix Version/s: 1.0-beta-4
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      There is one single thing that is worse than a two-way relationship, and that is a many-to-many two-way relationship. PicoContainer currently has both. (A container can have several parents.)

      The amount of code needed to maintain this relationship is actually a large percentage of the entire PicoContainer!!

      If someone really, really needs it state your reasons here. I think it can (and should) be solved as a PicoExtra-extension to the default PicoContainer.

      Related to PICO-92.

      This needs to be resolved before 1.0.

        Activity

        Hide
        Leo Simons added a comment -

        Multiple parents is vital.

        Example: I have an avalon-fortress container holding avalon components, a spring factory holding javabeans, an eob container holding enterprise objects, a pico container holding type 3 objects.

        I really want the ability to aggregate these together and use them as one container. The only way that's currently feasible with pico is to use them as parents:

        public void testMultipleParents()

        { Container fc = getFortressContainer(); PicoContainer pfc = getPicoContainer( fc ); BeansFactory bf = getSpringBeanFactory(); PicoContainer pbf = getPicoContainer( bf ); BeanBroker bb = getBeanBroker(); PicoContainer pbb = getPicoContainer( bb ); MutablePicoContainer c = getPicoContainer(); c.addParent( pfc ); c.addParent( pbf ); c.addParent( pbb ); // can now access things from c, fc, bf and bb through // my 'c' reference }

        do note that it is possible to remove the notion of hierarchies but retain this use case. But that will require significant refactoring. See my comments in PICO-90, PICO-91 and from Thomas on the mailing list.

        Show
        Leo Simons added a comment - Multiple parents is vital. Example: I have an avalon-fortress container holding avalon components, a spring factory holding javabeans, an eob container holding enterprise objects, a pico container holding type 3 objects. I really want the ability to aggregate these together and use them as one container. The only way that's currently feasible with pico is to use them as parents: public void testMultipleParents() { Container fc = getFortressContainer(); PicoContainer pfc = getPicoContainer( fc ); BeansFactory bf = getSpringBeanFactory(); PicoContainer pbf = getPicoContainer( bf ); BeanBroker bb = getBeanBroker(); PicoContainer pbb = getPicoContainer( bb ); MutablePicoContainer c = getPicoContainer(); c.addParent( pfc ); c.addParent( pbf ); c.addParent( pbb ); // can now access things from c, fc, bf and bb through // my 'c' reference } do note that it is possible to remove the notion of hierarchies but retain this use case. But that will require significant refactoring. See my comments in PICO-90 , PICO-91 and from Thomas on the mailing list.
        Hide
        Jon Tirsen added a comment -

        From the mailing list:

        I know Leo Simons has reasons for it to be supported, but I'm thinking whether it would be possible to do something in PicoExtras for this.

        I think Paul had written something previously that made a set of PicoContainers look like one single PicoContainer. Is that still around? That would be the best solution! You could use that "multi-container" as the (single) parent if you ever needed multiple parents.

        Joe Walnes wrote:

        > Uhhmm I can't remember why I'd ever need more than one parent, so ditch it (until I remember).
        >
        > -joe

        Show
        Jon Tirsen added a comment - From the mailing list: I know Leo Simons has reasons for it to be supported, but I'm thinking whether it would be possible to do something in PicoExtras for this. I think Paul had written something previously that made a set of PicoContainers look like one single PicoContainer. Is that still around? That would be the best solution! You could use that "multi-container" as the (single) parent if you ever needed multiple parents. Joe Walnes wrote: > Uhhmm I can't remember why I'd ever need more than one parent, so ditch it (until I remember). > > -joe
        Hide
        Aslak Hellesøy added a comment -

        It is a no-brainer to support multiple parents with a (GoF) aggregating proxy for PicoContainer - even if the API says one parent only. It's just a special implementation of PicoContainer that delegates to a set of others. This belongs in PicoExtras IMO.

        Paul wrote something like this, yes. I refactored it away. It's time to add it back in

        Show
        Aslak Hellesøy added a comment - It is a no-brainer to support multiple parents with a (GoF) aggregating proxy for PicoContainer - even if the API says one parent only. It's just a special implementation of PicoContainer that delegates to a set of others. This belongs in PicoExtras IMO. Paul wrote something like this, yes. I refactored it away. It's time to add it back in
        Hide
        Paul Hammant added a comment -

        Thanks

        Show
        Paul Hammant added a comment - Thanks
        Hide
        Leo Simons added a comment -

        Aslak wrote: "It is a no-brainer to support multiple parents with a (GoF) aggregating proxy for PicoContainer."

        LSD goes to hide in a corner, because so true it is. Forget I said anything.

        Show
        Leo Simons added a comment - Aslak wrote: "It is a no-brainer to support multiple parents with a (GoF) aggregating proxy for PicoContainer." LSD goes to hide in a corner, because so true it is. Forget I said anything.
        Jon Tirsen made changes -
        Field Original Value New Value
        Fix Version/s 1.0-beta-4 [ 10412 ]
        Fix Version/s 1.0 [ 10145 ]
        Jon Tirsen made changes -
        Component/s Core (Java) [ 10191 ]
        Jon Tirsen made changes -
        Assignee Jon Tirsen [ tirsen ]
        Aslak Hellesøy made changes -
        Assignee Jon Tirsen [ tirsen ] Aslak Hellesoy [ rinkrank ]
        Aslak Hellesøy made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Aslak Hellesøy added a comment -

        In progress on SINGLE_PARENT_REFACTORING branch in CVS.

        Show
        Aslak Hellesøy added a comment - In progress on SINGLE_PARENT_REFACTORING branch in CVS.
        Aslak Hellesøy made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Aslak Hellesøy
            Reporter:
            Jon Tirsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: