• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

True OO (Holub Style) using Aggregations.

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to follow Holub's pure OO philosophy about OOA/D.

So in the light of that, who is responsible for adding an object to
a library (or list of elements).

- The element itself will know what list to add itself to.
- The library will create a generic object, place it in the list,
and return it to the calling application.
- Or, a controlling application that creates the library and elements, and physically adds them to the list.

Any thoughts?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Zak Nixon:
I am trying to follow Holub's pure OO philosophy about OOA/D.



I'm curious - what is your motivation for doing so?

So in the light of that, who is responsible for adding an object to
a library (or list of elements).



I don't know what Holub would say, but to me it depends on what change patterns you observe/expect, that is, in which dimension(s) you need the design to be most flexible.

Can you tell us more about the objects and the library?
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, my motivation.......

In my past projects in doing the same technique, it has
made modifications to the code very simplistic, including
more reusable across entire application.

My objects: Pretty simplistic object structure...

I have an interface called ClickAndDropObj which will be an aggregate
object in a list called ClickAndDropObjLibrary.

There are other responsibilites of the CNDObjLibrary. Once and CNDObj
is added, the library will update its view (being a self contained GUI).
So at all times the CNDObject will know how to display itself.

But, my real confusion is the following:
I want the best way to add these elements to the library, but who really
needs the responsibility of doing so? The element, library, or moderator ?

If it is the element, then the element would be coupled with the library.
Likewise with the library.
The moderator would be the glue between the lib and aggregates. Mainly responsible for adding,removing, updating the list.

So, is there any best way to do so ?

Thanks for reading my post....
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Zak Nixon:
So, is there any best way to do so ?



Well, using a mediator between the element and the list sounds like the most flexible solution. On the other hand, it might already be more complex than you need it *now*, and I would probably feel comfortable refactoring to a more flexible solution should I need it later.

So I guess it mainly depends on how your current needs are, and how comfortable you are about guessing future needs, in contrast to refactoring the design later.
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic