Reusable Object Graphs
Intended AudienceSystem and application designers, programmers
Related areasGraphs, Model Theory, Complexity, Parallel processing, Integration, Security
AbstractJava objects which share parts of immutable graphs. They
ChallengeA lot of systems are modeled as a net of objects. In general the nodes refer to each other and form a cyclic graph. Let's have a modification of such net, where some of the objects are modified, either their attributes or references to other objects. We want to use both original and modified graphs at the same time.
It would make sense to share components which are same in both old and new nets. Only the elements which got modified should replace their old (obsolete) counterparts. There may be a lot of unchanged objects in both nets. However, some of them refer (directly or mediately) to elements which are obsolete in the new graph. That makes old and new graphs different as a whole. Sharing nodes is difficult and normally it involes a deep copy of the whole net.
Should we update references to modified objects at their every occurrence? That would trigger replacement of other elements which refer to obsolete nodes. It would be a domino effect. The only untouched parts would be "leaf graphs" - trees within cyclic graphs - and unchanged "lonely graphs" - islands. They don't refer to originals of the replaced objects and can be safely shared.
GoalReuse any parts of Object Graphs of any topography.
IdeaWe want to share unchanged elements by both old and new graphs. Some of the old elements are replaced (mirrored) by new nodes. References to old objects must be replaced by their new counterparts when evaluated within a new graph. References are evaluated within a Context. It's a meta structure which lists all active mirrors.
When an obsolete reference is evaluated in new Context, the reference is translated (mirrored) to a respective new object. Unchanged elements, which were not modified in the new net, are shared within both new and old Context.
Objects and Graphs
Application designer describes systems as nets of immutable objects - Elements. Those are of customized type and access other objects under their actual types.
Mechanism of Reusable Objects is described and operates in terms of graphs. However, that is only an internal representation hidden from user objects. Elements are defined and interact only in terms of objects and their relations. Reusable Objects don't have any graph-based public application interface (API).
|Copyright (c) 2005, 2006, 2007 Peter Kehl|