RenderingPatternsforAdaptiveObject Models
RenderingPatternsforAdaptiveObject Models
ABSTRACT using the PROPERTY pattern [5]. The TYPE OBJECT pattern is
An Adaptive Object-Model is an instance-based software system used again to define the legal types of attributes, called
that represents domain-specific classes, attributes, relationships, PropertyTypes. Thus Entity, EntityType, Property, and
and behavior using metadata.. This paper presents three patterns PropertyType are the core set of constructs used to represent
for visually presenting and manipulating AOM domain entity Adaptive Object-Models [13].
objects. An Adaptive Object-Model expresses relationships between
entities using metadata. Any rules and constraints governing these
Categories and Subject Descriptors relationships can also be described with metadata. In contrast,
D.1.5 [Programming Techniques]: Object-oriented with traditional object-oriented programs, relationships between
Programming; D.2.2 [Design Tools and Techniques]: Object- domain entity objects are implemented via a direct reference or an
oriented design methods, User Interfaces; D.2.11 [Software appropriate structuring object (e.g. hash table or a collection).
Architectures]: Patterns Constraints on relationships are implemented by methods in
related classes.
General Terms
Design In an Adaptive Object-Model, the STRATEGY pattern [6] can be
used to define the behavior of EntityTypes. If behavior is
Keywords complex, instead of using Strategies, an interpreted rule-based
Visual Rendering, Adaptive Object-Models, Patterns language can be defined. In contrast, with a typical object-
oriented programming language implementation of an entity,
1. INTRODUCTION simple behavior is typically implemented in class methods.
An Adaptive Object-Model is an instance-based software system
that represents domain-specific classes, attributes, relationships, The above core AOM patterns have been described previously.
and behavior using metadata [19, 20]. Typically in an Adaptive One area that has not been described are how to implement the
Object-Model, metadata descriptions are stored in a database and user interface in an AOM system. Since an AOM is instance
interpreted at runtime. This is similar to a UML Virtual Machine based rather than class based and has metadata which drives
described by [12]. The object model is adaptable and tools are domain entity behavior, interpretation of the entities needs to be
often provided with AOM systems that allow end users or domain considered when constructing a user interface. This paper
experts to edit and change these metadata descriptions. So when describes patterns for dynamically building the GUI layer which
changing requirements cause the domain model to be updated, end supports the modification and visualization of AOM domain
users edit metadata. These changes can immediately be reflected objects.
in the running system without any software program changes.
2. TOWARDS AN ADAPTIVE OBJECT-
In contrast, in a typical object-oriented program, classes are MODEL PATTERN LANGUAGE
designed to represent domain entities and their attributes. A Adaptive Object-Model architectures are usually made up of
change in requirements that results in changes to the domain several smaller patterns. In the existing literature they are
model causes developers to modify and/or add new classes, documented by the patterns TYPE OBJECT, ATTRIBUTES,
leading to a new application version. PROPERTY LIST, TYPE SQUARE, ACCOUNTABILITY
Adaptive Object-Model architectures are typically made up of (Entity-Relationship), STRATEGY, RULE OBJECTS,
several interrelated patterns. TYPE OBJECT [8] is used to define COMPOSITE, BUILDER, and INTERPRETER.
a domain entity. An entity has attributes, which are represented
Besides these patterns, less widely-known patterns are often used
Permission to make digital or hard copies of all or part of this work for in AOM systems. In the AOM current literature descriptions of
personal or classroom use is granted without fee provided that copies are these other patterns are scattered among a number of different
not made or distributed for profit or commercial advantage and that
copies bear this notice and the full citation on the first page. To copy
otherwise, or republish, to post on servers or to redistribute to lists,
requires prior specific permission and/or a fee.
PLoP'07, September 5-8, Monticello, IL, U.S.A..
Copyright 2007 Hillside Group.
Figure 1 - AOM Pattern Language Map
patterns papers with different templates and styles. Additionally, Entity View: describes the coordination of several property
not all these papers work through similar examples. Some patterns renderers to produce more complex UI fragments for an entity
have not been updated to reflect implementation trends, new (rendered from descriptive data from the type objects).
programming language environments or development platforms. Entity-Group View: given a set of entities, renders UI code
We ultimately see the patterns described in this paper as part of a (including layout issues). Several different views can exist for the
more complete pattern language for building Adaptive Object- same set of entities and they can be linked dynamically at run-
Models. Patterns in this pattern language are organized into these time (useful to present a set of entities).
categories:
The patterns presented in this paper are interrelated. While they
Core: patterns that represent the basic implementation of can be used individually, more commonly they are used in
AOM entities, their behavior and relationships. They are the
ones that govern this architectural style.
Process: patterns that describe how to create and evolve Property Renderer coordinates several… Entity View
AOM systems. They establish guidelines and advice on when
and where the use of meta-description based approaches is
warranted.
can use… can use…
The resulting structure should be easy to change. Figure 5 presents the UML class diagram of the solution. The
abstract class EntityView defines the public interface and basic
You donʼ t want redundant UI code. behavior of all entity views. It also maintains a set of
PropertyRenderer instances (see the PROPERTY RENDERER
You may want to use different sets of fragments in
different contexts (for example, you may use different pattern in this paper) which are coordinated to generate UI code
renders for a mobile device than for a web browser). for an entity instance. The concrete EntityViews can be leafs
(stand-alone views) or composite (composing several entity views
3.3.5 Solution to generate the output). An EntityView receives context
Create view components which coordinate the presentation of information from its associated RenderingContext. Some
several property renderers of an entity to produce different constraints can be applied to the orchestration process (classes
complex UI fragments. Each property renderer is specialized to EntityViewConstraint, Validation and Rule). These
generate UI code for instances of a property type in a certain constraints can be composed to create dynamically complex
context. A view component will coordinate several fine-grained validation or composition rules.
renderers and produce more complex UI code for an entity.
3.3.6 Example Resolved
The sequence and composition of renderers could be specified
You can create two different kinds of EntityViews: ones for
using source code or with metadata stored in a database or a file.
editing and others for visualizing. These views may be used in all
Figure 6 - Entity View Example
applications, giving consistency to their UIs (the same group of The indirection interpretation of metadata found in this
elements is rendered in a consistent way in all applications) and solution can lead to lower performance than in a non-AOM
simplifying maintenance (the property renderer coordination code system.
is in a single, well-known location).
In Figure 6, two EntityViews are shown: the first, called 3.3.8 Variants
EditableEntityView, allows for editing an instance of an Form Entity View: orchestrates several property renderers to
entity (in this case to create a new Document entity representing create a form for data input. It may also contain constraints which
the paper “ Dynamic Object Model” [13]). Notice how all the establish input validations, and rules for showing or hiding groups
editing UI widgets shown are the same as those shown previously of renderers, etc.
in Figure 4 for the PROPERTY RENDERER pattern. The second Table Row Entity View: orchestrates several property renderers
EntityView, called ReadOnlyEntityView, in the lower to create a table showing an each entity in a row of a grid. To
section of the figure renders a read-only representation of the show a full grid this Entity View must be applied to a set of
Document entity. In this view no Document entity properties entities in an ENTITY-GROUP VIEW.
can be edited. Note that this EntityView shows additional Selection of Fields Entity View: in this case the view selects a set
Document properties. of the fields of an entity type (or a discrete set of property
3.3.7 Resulting Context instances) and generates the output. For example, you can have
UI composition of rendering entities can be abstracted, several views for a type of entity where each view shows a
encapsulated and easily modified. different subset of entity properties. For example, in case of an
entity type “ Patient” you could have an entity renderer that only
The rules for showing an instance of an AOM entity can be shows its contact info and another one that shows only the ID, the
modified dynamically at runtime. name and the birth date.
The rules for showing an instance of an AOM entity can be Full Display Entity View: this view displays all the fields in the
modified declaratively (when rules are stored as metadata). entity type or the provided set of property instances.
The rules for showing an entity are explicitly stated. Rule Based Entity View: this more complex entity view selects
It is easy to change the way entities are shown. the property renderers to be used by applying rules. For example,
you may have an entity view that shows or hides fields according
Better adaptability to new visualization requirements.
to profile of the target user.
More flexibility in constructing different visualizations than
with hand-coded solutions. 3.3.9 Related Patterns
An ENTITY VIEW coordinates several PROPERTY RENDERERS.
This introduces more complexity in the form of additional
ENTITY VIEW can be seen as a typed COMPOSITE of PROPERTY
classes and interpretation of metadata.
RENDERERS for displaying entities.
ENTITY VIEW generates output using PROPERTY RENDERERS; rendering algorithm that could be applied to different contexts.
ENTITY-GROUP VIEWS display a set of related entities. Additionally, if you want to reuse the UI generation code for
RENDERING ORCHESTRATOR performance can be dramatically another application you wonʼ t be able to, since it would be
enhanced using CACHING [11]. contained in a page and therefore could not be reusable artifact in
another application (in the best case, you might copy the page, but
ANYTHING [15] has a similar abstraction called Renderer, but with if you want to change a single feature of that “ common page” , you
a broader scope. To use this pattern to render ANYTHING would need to modify all instances of that page in all client
instances, you can construe ENTITY VIEW to be a specialized applications).
instance of such renderers.
3.4.3 Problem
3.4 Entity-Group View How can you abstract the visualization (including the complex
3.4.1 Context layout) of a set of dynamic entities from an AOM so as to
You want to generate UI code for several entities but you donʼ t decouple this visualization from the model?
want to have any kind of coupling or to reference the UI in your 3.4.4 Forces
model. Additionally you may want to attach or detach views to You want to be able to attach and detach views
models, allowing for different views of the same entity to be dynamically to sets of entities.
selected dynamically. You want several views applied to the same
model and you want to have the possibility of selecting any of You want to abstract layout details.
them according to arbitrary decisions. You want to render several entities in the same
presentation.
3.4.2 Example
You are developing a Web-based Content Management You want to reuse that rendering code in different
application (the one quoted in the Property Renderer pattern). You contexts.
built a Document Management module on top of the CMS engine. You donʼ t want redundant UI code.
This content management module has entities Document and
You want to have control of all the generated UI code.
Link that are contained in Categories (a special kind of
entity which contains other entities). Categories simulate You may not be using PROPERTY RENDERERS or ENTITY
Folders in the document management module. VIEWS.
When using PROPERTY RENDERERS or ENTITY VIEWS
Whenever a user selects one Folder, its contents (the contained you may want to add additional UI code (layout code,
entities) should be displayed in one of several ways depending on glue code to give consistency and context to the
the specific context. You want to be able to attach and detach renderer properties, or perhaps code unrelated to
views to the folders. For example, a thumbnails view might only entities).
be applied to folders which contain images. Views should be
easily linked to and unlinked from categories, allowing users to 3.4.5 Solution
specify how they want to view folder contents according to their Abstract the UI code generation into a view component that
preferences. processes a set of entities to produce UI code. The
EntityGroupView is a component specialized in generating
Having the UI generation code static on a web page is not a very
UI code for a set of one or more entities. It will produce the
good idea because it would complicate your abstraction of a
appropriate UI code according to the purpose of the view. As in
cd Attachable View s
EntityGroupView
+ Render(Entity[]) : object
+ SetParameters(Hashtable) : void
PropertyRenderer
EntityView
- id: string
+ Render(Entity, RenderingContext) : object
1..* + SetParameters(Hashtable) : void
+ Render(Property) : object
+ SetParameters(Hashtable) : void + ApplyConstraints() : ConstraintResult[]
[8] Johnson, R., R. Wolf. Type Object. Pattern Languages of [18] Welicki L; O. Sanjuan Martinez. Improving Performance and
Program Design 3. Addison-Wesley, 1998. Server Resource Usage with Page Fragment Caching in
Distributed Web Servers. International Conference on
[9] Microsoft .NET Framework. [Link] Parallel and Distributed Processing Techniques and
[10] Buschman, F. et al. Pattern Oriented Software Architecture, Applications (PDPTA 2007), Las Vegas, Nevada, June 2007.
Volume 1: A System of Patterns. Wiley & Sons. 1996 [19] Welicki L; J. Yoder; R. Wirfs-Brock; R. Johnson. Towards a
[11] Kircher, M.; P. Jain. Pattern Oriented Software Architecture, Pattern Language for Adaptive Object Models. Companion
Volume 3: Patterns for Resource Management. Wiley & of the ACM SIGPLAN Conference on Object Oriented
Sons, 2004. Programming, Systems, Languages and Applications
(OOPSLA 2007), Montreal, Quebec, Canada, 2007.
[12] Riehle, D., Fraleigh S., Bucka-Lassen D., Omorogbe N. The
Architecture of a UML Virtual Machine. Proceedings of the [20] Yoder, J.; F. Balaguer; R. Johnson. Architecture and Design
2001 Conference on Object-Oriented Program Systems, of Adaptive Object-Models. Proceedings of the ACM
Languages and Applications (OOPSLA ʼ 01), October 2001. SIGPLAN Conference on Object Oriented Programming,
Systems, Languages and Applications (OOPSLA 2001),
[13] Riehle D., M. Tilman, and R. Johnson. "Dynamic Object
Tampa, Florida, USA, 2001.
Model." In Pattern Languages of Program Design 5. Edited
by Dragos Manolescu, Markus Völter, James Noble. [21] Yoder, J.; R. Johnson. The Adaptive Object-Model
Reading, MA: Addison-Wesley, 2005. Architectural Style. IFIP 17th World Computer Congress -
TC2 Stream / 3rd IEEE/IFIP Conference on Software
[14] Revault, N, J. Yoder. Adaptive Object-Models and
Architecture: System Design, Development and Maintenance
Metamodeling Techniques Workshop Results. Proceedings
(WICSA 2002), Montréal, Québec, Canada, 2002
of the 15th European Conference on Object Oriented
Programming (ECOOP 2001). Budapest, Hungary. 2001. [22] Yoder, J.; R. Razavi. Metadata and Adaptive Object-Models.
ECOOP Workshops (ECOOP 2000), Cannes, France, 2000.
APPENDIX- A BRIEF SUMMARY OF THE dynamic tree like structure, the COMPOSITE pattern is applied.
BUILDERS and INTERPRETERS are commonly used for building the
ARCHITECTURAL STYLE OF AOMS structures from the meta-model or interpreting the results.
Important Notice: This section is a summary extracted from [21]
and [20] and has been included to help readers unfamiliar with But, these are just patterns; they are not a framework for building
the AOM architectural style. To get a more complete view we Adaptive Object-Models. Every Adaptive Object-Model is a
recommend the reader read the original papers found at framework of a sort but there is currently no generic framework
[Link]. for building them. A generic framework for building the
TypeObjects, Properties, and their respective relationships could
The design of Adaptive Object-Models differs from most object- probably be built, but these are fairly easy to define and the hard
oriented designs. Normally, object-oriented designs have classes work is generally associated with rules described by the business
which model the different types of business entities and associate language. These are usually very domain-specific and varied
attributes and methods with them. The classes model the from application to application.
business, so a change in the business causes a change to the code,
which leads to a new version of the application. An Adaptive Type Square
Object-Model does not model these business entities as classes. In most Adaptive Object Models, TYPE OBJECT is used twice:
Rather, they are modeled by descriptions (metadata) which are once before using the PROPERTY pattern, and once after it. TYPE
interpreted at run-time. Thus, whenever a business change is OBJECT divides the system into Entities and EntityTypes.
needed, these descriptions are changed, and can be immediately Entities have attributes that can be defined using
reflected in a running application. Properties. Each Property has a type, called
Adaptive Object-Model architectures are usually made up of PropertyType, and each EntityType can then specify the
several smaller patterns. TYPE OBJECT [8] provides a way to types of the properties for its entities. Figure 10 represents the
dynamically define new business entities for the system. TYPE resulting architecture after applying these two patterns, which we
OBJECT is used to separate an Entity from an call TYPE SQUARE [20].
EntityType. Entities have Attributes, which are
implemented using the PROPERTY pattern [5]. The TYPE OBJECT cd AOM
Therefore, we can say that the core patterns that may help to Property PropertyType
describe the AOM architectural style are: 0..* +type
TYPE OBJECT
PROPERTY Figure 10. The Type Square.
ENTITY-RELATIONSHIP / ACCOUNTABILITY TYPE SQUARE often keeps track of the name of the property and
STRATEGY / RULE OBJECT whether the value of the property is a number, a date, a string, etc.
INTERPRETER (of Metadata) The result is an object model similar to the following: Sometimes
objects differ only in having different properties. For example, a
Adaptive Object-Models are usually built from applying one or system that just reads and writes a database can use a Record with
more of the above patterns in conjunction with other design a set of Properties to represent a single record, and can use
patterns such as COMPOSITE, INTERPRETER, and BUILDER [6]. RecordType and PropertyType to represent a table.
COMPOSITE is used for building dynamic tree structure types or
rules. For example, if the entities need to be composed in a