Investigate the concept of a root object collection container #8

Closed
hisystems opened this Issue Mar 4, 2012 · 1 comment

Projects

None yet

1 participant

@hisystems
Owner

Usually a root object container is required that contains all of the collection objects at the root of the object hierarchy. Typically, access is required to root object so that object references can be created or returned, because a relationship exists between two objects. It would be ideal if the root object (which contains all of the collection objects) can be accessed from any object that is utilising the library (i.e. inheriting from DatabaseObject or DatabaseObjects). This would avoid having to pass around the root object in each constructor or having to workaround the issue by creating new instances of collections (instead of managing one collection instance contained in the root object).

@hisystems hisystems was assigned Mar 4, 2012
@hisystems
Owner

Thoughts so far:

  • the root object should contain a reference to a Database object.
  • it should NOT inherit from Database because that will expose a number of public methods/properties - in addition it is conceptually not really representing a database, it is representing a set of collection objects.
  • the root object should be accessible automatically from any class inheriting from DatabaseObject or DatabaseObjects
  • the root object should not be static / shared as this would:
    • be the most future proof method
    • allow for the object to be passed around the library (if it is static / shared this will be impossible)
    • allow for the creation of an abstract / mustinherit class that can be appropriately structured - and contain the Database object - as indicated above.
@hisystems hisystems added a commit that closed this issue Mar 21, 2012
@hisystems Added RootContainerObject concept. Closes #8.
This allows a root container object to be accessed from any object in the model. The overrides the existing functionality of providing a database for a root collection. If there are multiple levels to the hierarchy then changing the root collection object to utilise a RootContainer will allow all children to automatically find the reference to the parent root container object.
038d490
@hisystems hisystems closed this in 038d490 Mar 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment