View
216
Download
0
Category
Preview:
Citation preview
Representing Representing Patterns in UMLPatterns in UML
Andy BulkaAndy Bulkawww.atug.com/andypatternswww.atug.com/andypatterns
Technical DirectorTechnical DirectorAusthink SoftwareAusthink Softwarewww.austhink.comwww.austhink.com
IBM Rational - pattern IBM Rational - pattern instance itself is a first instance itself is a first class modeling elementclass modeling element
The pattern instance itself is a first class The pattern instance itself is a first class modeling element, and appears in the modeling element, and appears in the model and can be placed in a diagram model and can be placed in a diagram and has relationships to other model and has relationships to other model elements that bind its parameters to elements that bind its parameters to actual model elements. actual model elements.
Having pattern instances in a model help Having pattern instances in a model help designers understand which patterns designers understand which patterns have been applied (since many might have been applied (since many might have been).have been).
The competitorsThe competitors IBM Rational has “pattern instances” on your IBM Rational has “pattern instances” on your
UML diagram and you can re-apply a pattern and UML diagram and you can re-apply a pattern and it enforces it. it enforces it.
ObjectIf has some pretty cool design pattern ObjectIf has some pretty cool design pattern support and uses roles and colors to indicate support and uses roles and colors to indicate patterns.patterns.
EA (Enterprise Architect has design pattern EA (Enterprise Architect has design pattern support, though the merge feature is a bit buggy support, though the merge feature is a bit buggy at the moment).at the moment).
StarUML is free, and has a configurable patterns StarUML is free, and has a configurable patterns system.system.
ModelMaker, classic pattern “enforcer”, with ModelMaker, classic pattern “enforcer”, with code regions etc. Now a bit old, has only a code regions etc. Now a bit old, has only a limited number of patterns – to be improved in limited number of patterns – to be improved in the next few months.the next few months.
Applying Patterns to the Applying Patterns to the workspaceworkspace
Most have a clear, standard way of Most have a clear, standard way of applying patterns i.e. you specify if you applying patterns i.e. you specify if you want to create a want to create a newnew class or class or mergemerge a a role with an existing class. UML role with an existing class. UML diagram previews in the pattern diagram previews in the pattern wizards, too. And most tools also have wizards, too. And most tools also have a way of representing the pattern on a way of representing the pattern on the diagram e.g. collaboration lines or the diagram e.g. collaboration lines or class stereotypes or association lines class stereotypes or association lines with role labels. with role labels.
Rational has Rational has drag dropdrag drop wiring – nice. wiring – nice.
Pattern is comprised ofPattern is comprised of
Classes (one or more)Classes (one or more) AttributesAttributes MethodsMethods Code fragments within methods Code fragments within methods
(aspects?)(aspects?) Meta information tying all the above Meta information tying all the above
togethertogether
Ways of Representing the Ways of Representing the Grouping of classesGrouping of classes
Shading areas behind classes, Shading areas behind classes, grouping them. (vlissedes)grouping them. (vlissedes)
Shaded areas can overlap to indicate Shaded areas can overlap to indicate classes performing different roles classes performing different roles within different patterns i.e. within different patterns i.e. a class a class can be part of more than one can be part of more than one patternpattern
Sticky notes near classesSticky notes near classes Role labels on properties (ObjectIf)Role labels on properties (ObjectIf)
Ways of Representing the Ways of Representing the Grouping of classesGrouping of classes
Collaboration objects (Rational)Collaboration objects (Rational) Text Lists in a panel (ModelMaker)Text Lists in a panel (ModelMaker) Package diagrams with interfaces to Package diagrams with interfaces to
the pattern exposed. the pattern exposed.
The Software ToolsThe Software Tools
DemoDemo
Rational (by IBM and the inventors of UML)
ObjectIF – excellent pattern support. Gui overly redundant and confusing in some places, but community edition is free.
StarUML – free, poor code generation but has customisation facility in some javascript like language. Documentation poor.
Modelmaker – pattern support lags behind – missing complete set of GOF patterns. Check it again in 2007.
Enterprise Architect – pattern blending support poor, but good UML tool with good reverse engeneering and layout. Interface very messy though. Affordable.
StarUMLStarUML
Free Free tooltool
StarUMLStarUML
R.click and select Apply PatternR.click and select Apply Pattern
StarUMLStarUML
Select the class you want to apply Select the class you want to apply the singleton to. If you don’t select, the singleton to. If you don’t select, a new class will be created.a new class will be created.
StarUMLStarUML
Voila!Voila!
StarUMLStarUML
To view the generated code, r.clickTo view the generated code, r.click
StarUMLStarUML
Output not very correct in this case – Output not very correct in this case – missing private constructor.missing private constructor.
Other demosOther demosI demo’d all the 5 tools on the night, and there is a video of me doing them all. At the moment the only video released is on my websiteis the Rational portion of the demo - see http://www.atug.com/andypatterns/pattern_automation_in_uml.htm
Final wordFinal word
Also seeAlso see http://www.atug.com/andypatterns/patterhttp://www.atug.com/andypatterns/patterns.htmns.htm
for paper on design pattern automation – for paper on design pattern automation – pros and cons and is it a good idea in the pros and cons and is it a good idea in the first place.first place.
Recommended