|
The Pattern Binding Editor (PEdit) can be used to instantiate Patterns from
our Pattern Catalog and bind them to a class model.
This class model describes the static aspects of a software component and can
be created using a MOOSE editor.
After loading a class model and a domain-specific pattern catalog, patterns can be bound to the class model. This is done by instantiating appropriate patterns and by selecting values and assigning them to the pattern's interface. The interface of a Pattern is described by formal parameters. Parameter types are used to ensure that only syntactical correct bindings can be performed. The type of a formal parameter can be one of: Object, Relation, Attribute, method interface (Interface), method implementation (Method), or Expression. In addition to these types, a formal parameter can have the type Set of Objects, Set of Relations, or Set of Methods. The latter parameter types are used to bind a Pattern to more than one relation or method.
We distinguish between method implementations and method interfaces
(compare template-and hook-methods in /Pre95/):
the code generation for a pattern will be done for method implementations
whereas interfaces are used to communicate with other objects or patterns.
The pattern editor, by comparing formal parameters with actual bindings,
enforces that only correct bindings can be used. We allow subtyping to get
more flexible pattern bindings, e.g. an attribute can be accessed via a
corresponding method so that a formal parameter of the type
method interface can also be bound to an attribute.
The following picture shows the user interface of PEdit. Click on the image to get the screen dump in its original size. Rectangles and lines represent classes and relations respictively, while clouds represent pattern instances. Bindings of type Object are displayed as diagonal lines.
Pattern bindings are performed using special edit windows:
...
ThermalMass
bind: 'target' to: 'Room';
bind: 'amountOfHeat' to: 'amountOfHeat';
bind: 'volume' to: 'volume';
bind: 'getHeatFlowFor' to: 'getHeatFlowFor';
bind: 'compute' to: 'doCalcLoop';
bind: 'temperature' to: 'temperature';
bind: 'getHeatCapacity' to: 'heatCapacity'.
FollowRelationAndSum
bind: 'target' to: 'Room';
bind: 'relation' to: '#(#Surfaces #intoWalls )';
bind: 'parameter' to: 'theCaller';
bind: 'operation' to: 'getHeatFlowFor'.
...
The formal interface of each pattern is described with a separate description file. These descriptions can be loaded dynamically into PEdit. The description of one of our Patterns (ContinousComputation) looks as follows:
Pattern ContinuousComputation Category active
ObjectType use target
SingleRelation use activeObject
SingleRelation use event
Attribute use preset interval
SingleMethod implement preset establish
SingleMethod use compute
SingleMethod implement preset init
Expression implement priority
End
The format for these description files
can be found here.
|
|
|