13.07.2015 Views

Modeling Software Architectures in the Unified Modeling Language

Modeling Software Architectures in the Unified Modeling Language

Modeling Software Architectures in the Unified Modeling Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Model<strong>in</strong>g</strong> <strong>Software</strong> <strong>Architectures</strong> <strong>in</strong> UML • 9applied to model elements, effectively creat<strong>in</strong>g a new yet restricted formof meta class for construct<strong>in</strong>g models. The semantic effect is as if <strong>the</strong> constra<strong>in</strong>tsand tagged values were attached directly to those elements. For<strong>in</strong>stance, <strong>in</strong>terfaces are identified <strong>in</strong> class diagrams by attach<strong>in</strong>g <strong>the</strong> stereotypename to class icons; among o<strong>the</strong>r th<strong>in</strong>gs, <strong>the</strong> stereotypeconstra<strong>in</strong>s an <strong>in</strong>terface to declare only operations and no attributes.(4) Profiles are predef<strong>in</strong>ed sets of stereotypes, tagged values, constra<strong>in</strong>ts, andicons to support model<strong>in</strong>g <strong>in</strong> specific doma<strong>in</strong>s. The UML specification currentlydef<strong>in</strong>es profiles for <strong>the</strong> <strong>Unified</strong> Process and for Bus<strong>in</strong>ess <strong>Model<strong>in</strong>g</strong>[Object management Group 2000].It is possible to express constra<strong>in</strong>ts on UML models us<strong>in</strong>g <strong>the</strong> Object Constra<strong>in</strong>t<strong>Language</strong>, which comb<strong>in</strong>es first-order predicate logic with a diagramnavigation language [Object Management Group 2000; Warmer and Kleppe1998]. Each OCL expression is specified and evaluated <strong>in</strong> <strong>the</strong> context of (<strong>the</strong> <strong>in</strong>stancesof) some model element (referred to as self) and may use attributes andrelationships of that element as terms. The self <strong>in</strong>stance may be a UML classifier(such as a class or an <strong>in</strong>terface), or an element used by a classifier (such asan attribute, an operation, or an end element of associations), or ano<strong>the</strong>r typeof model element. OCL also def<strong>in</strong>es operations on sets, bags, and sequences tosupport construction and manipulation of collections of model elements <strong>in</strong> OCLexpressions. For <strong>in</strong>stance, <strong>the</strong> operations def<strong>in</strong>ed with<strong>in</strong> a class form a set thatcan be traversed <strong>in</strong> order to apply a constra<strong>in</strong>t to each operation.The top of Figure 3 illustrates a simple OCL constra<strong>in</strong>t on <strong>the</strong> <strong>in</strong>stances ofclass Company (<strong>the</strong> self model element) expressed <strong>in</strong> terms of <strong>the</strong> card<strong>in</strong>alitiesof its associations with Robot and Worker classes. Each association is identifiedby <strong>the</strong> name of <strong>the</strong> role filled by <strong>the</strong> class at <strong>the</strong> o<strong>the</strong>r end of <strong>the</strong> association. Bydefault, <strong>the</strong> role name is <strong>the</strong> name of <strong>the</strong> class itself with <strong>the</strong> first letter changedto lower case, and <strong>the</strong> role name evaluates to <strong>the</strong> set of all <strong>in</strong>stances fill<strong>in</strong>g <strong>the</strong>role. Referr<strong>in</strong>g to associations and roles <strong>in</strong> this manner provides a means ofnavigat<strong>in</strong>g through <strong>the</strong> enclos<strong>in</strong>g diagram and is <strong>the</strong>refore a key technique forconstruct<strong>in</strong>g constra<strong>in</strong>ts <strong>in</strong> OCL. The predef<strong>in</strong>ed property size is used to obta<strong>in</strong>card<strong>in</strong>alities of collections of elements (<strong>in</strong> this case, <strong>the</strong> number of elementsfill<strong>in</strong>g <strong>the</strong> robot role and <strong>the</strong> number of elements fill<strong>in</strong>g <strong>the</strong> worker role). Thus,<strong>the</strong> constra<strong>in</strong>t says that <strong>the</strong> number of <strong>in</strong>stances of Robots aggregated to an<strong>in</strong>stance of Company divided by <strong>the</strong> number of <strong>in</strong>stances of Workers aggregatedto <strong>the</strong> <strong>in</strong>stance of Company must be less than one-tenth.We fur<strong>the</strong>r describe and illustrate OCL with constra<strong>in</strong>ts on <strong>the</strong> UML metamodel <strong>in</strong> <strong>the</strong> next section and <strong>in</strong> Section 5.2.3 The UML Meta ModelAs mentioned above, UML is a graphical language with semiformal syntaxand semantics, which are specified via a meta model, <strong>in</strong>formal descriptive text,and constra<strong>in</strong>ts [Object Management Group 2000]. The meta model is itself aUML model that specifies <strong>the</strong> abstract syntax of UML models. For example, <strong>the</strong>UML meta model states that a Class is one k<strong>in</strong>d of model element with certa<strong>in</strong>attributes, and that a Feature is ano<strong>the</strong>r k<strong>in</strong>d of model element with its ownACM Transactions on <strong>Software</strong> Eng<strong>in</strong>eer<strong>in</strong>g and Methodology, Vol. 11, No. 1, January 2002.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!