Improving Naming and Grouping in UML

540
-1

Published on

Slides of the talk at ECMDA 2011, Brimingham, June 2011
ABSTRACT:
The package is one of the basic UML concepts. It is used both to group model elements and to provide a namescope for its members. However, combining these two tasks into a single UML concept can become not only too restrictive but also a source of subtle problems. This paper presents some improvements to the current UML naming and grouping schemata, using the ideas proposed in the reference model of Open Distributed Processing (ODP). The extensions try to maintain backwards compatibility with the existing UML concepts, while allowing more flexible grouping and naming mechanisms.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
540
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Improving Naming and Grouping in UML

  1. 1. Improving Naming and Grouping in UML<br />Antonio Vallecillo<br />Universidad de Málaga, Spain<br />http://www.lcc.uma.es/~av<br />
  2. 2. Context<br />Specification of non-trivial systems using UML and ODP<br />UML as base language<br />UML4ODP Profiles to represent ODP concepts<br />Viewpoint Modeling to structure the systems specs<br />Five viewpoints <br />Correspondences between them <br />Retail, eHealth, Aerospace<br />Heterogeneous Federated modeling<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />2<br />
  3. 3. UML package<br />The package is the UML mechanism for groupingmodeling elements<br />Provides a namespace for its members (P::x)<br />Owns its members (if a package is removed from a model, so are its members)<br />PackageImport<br />Allows using unqualified namesto refer to elements in other packages<br />PackageMerge<br />Allows extending the contents of one package with the contents from another<br />The receiving package is modified, being replaced by the duplicate-free union of the two packages<br />Names are used to identify corresponding elements<br /> [Import deals with naming issues, Merge deals with contents]<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />3<br />
  4. 4. Issues<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />4<br />
  5. 5. Issues about the UML package itself<br />Imposes a hierarchical tree structure, in which one model element cannot belong to more than one package<br />No flexible organization schema <br />Sometimes we want to group elements according to several criteria (there is no single organizational criteria that fits all purposes)<br />Elements may have at most one name<br />This assumes a single global naming scheme<br />It hinders heterogeneous federated modeling<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />5<br />
  6. 6. Issues about PackageImport<br />It does not work well with name clashes<br />Name resolution is complex or even impossible sometimes<br />Has side-effects<br />The situation gets worse under the presence of OCL<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />6<br />[In this diagram, the OCL constraint in package P refers with no problems to class A in the outer package]<br />
  7. 7. Issues about PackageImport<br />It does not work well with name clashes<br />Name resolution is complex or even impossible sometimes<br />Has side-effects<br />The situation gets worse under the presence of OCL<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />7<br />[Now, the OCL constraint refers to class A in package Q, which can cause problems if there is no age attribute in A]<br />
  8. 8. Issues about PackageImport<br />It does not work well with name clashes<br />Name resolution is complex or even impossible sometimes<br />Has side-effects<br />The situation gets worse under the presence of OCL<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />8<br />[Now the OCL constraint refers back to class A in Outer package! Class C cannot be directly referenced any more]<br />
  9. 9. Issues about PackageMerge<br />Complex semantics<br />Complex side-effects<br />No warning of problems<br />No tool support<br />Complex behaviour when used under the presence of PackageImport<br />UML specification explicitly mentions it is only intended for expert modelers ("Don't do this at home")<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />9<br />
  10. 10. Our proposal<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />10<br />
  11. 11. A more flexible grouping schema<br />A group is <br />“a set of objects with a particular relationship that characterizes either the structural relationship among objects, or an expected common behaviour” <br />[RM-ODP Part 2, clause 10.1]<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />11<br />
  12. 12. A more flexible grouping schema<br />A group is <br />“a set of objects with a particular relationship that characterizes either the structural relationship among objects, or an expected common behaviour” <br />[RM-ODP Part 2, clause 10.1]<br />Have you used Gmail grouping scheme using labels? <br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />12<br />
  13. 13. A more flexible Naming schema<br />A namespace is a set of terms usable as names (strings, icons, …)<br />A naming context establishes the relations between names and entities<br />A name is a term that refers to an entity, in a naming context<br />A naming action associates a name to an entity<br />Naming contexts are named elements<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />13<br />[ISO 14771: ODP Naming Framework, 1999]<br />
  14. 14. Some examples<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />14<br />“perro” = “Inglés::dog”<br />
  15. 15. Name resolution<br />Given an identifier and a naming context, name resolution consists of finding a naming action for the identifier<br />context Identifier::resolve(C : NamingContext) : NamedElementbody: self.namingAction->any(namingContext = C).entity<br />context Identifier::canResolve(C : NamingContext) : Boolean body: self.namingAction->exists(namingContext = C)<br />The opposite operation is not that simple<br />contextNamedElement::name(C : NamingContext) : Identifier body: self.namingAction->any(namingContext = C).name<br /> …the problem is that this element may not be in that naming context but in others (indirect naming).<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />15<br />
  16. 16. Putting it all together<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />16<br />
  17. 17. The new elements<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />17<br />
  18. 18. Back to the future…<br />Integrating all this in UML<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />18<br />
  19. 19. Packages and groups can be used together in specifications<br />contextPackageableElement::name : Identifier <br />derive: self.name(self.group.namingContext))<br />context Package inv NamesItsElements: <br />self.member->forAll(name = name(self.namingContext))<br />Groups and Packages<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />19<br />
  20. 20. PackageImport<br />Why is there any need for PackageImport?<br />The need for PackageImport in UML is due to the dual nature of Packages as groups and as naming contexts, and that packages are the exclusive owners their members<br />PackageImport is needed be able to use an unqualified name to refer to an entity owned by another package<br />In our proposal it is enough to add its name to the naming context associated to the group<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />20<br />
  21. 21. New import operations<br />contextNamingContext::import(n : Identifier, e : NamedElement) : Boolean <br />post: <br />if (self.namingAction.name->excludes(n) <br />and self.namingAction.entity->excludes(e)) <br />then result = true and <br />self.namingAction-> includes (na | na.name = n and na.entity = e) <br />elseresult = ( n.resolve(self) = e ) <br />endif<br />contextGroup::import(n : Identifier, e : NamedElement): Boolean <br /> body: self.namingContext.import(n,e)<br />contextGroup::include( n : Identifier ) <br /> pre: n.canResolve(self.namingContext) <br /> post: self.member->includes(n.resolve(self.namingContext))<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />21<br />
  22. 22. Merging<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />22<br />
  23. 23. A new semantics for Merge<br />It now creates a new group with the result of the merge<br />Side-effect free<br />User-defined merging operation between elements<br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />23<br />
  24. 24. Conclusions<br />New UML grouping and naming mechanisms<br />Elements can belong to more than one group<br />Elements can have different names in different contexts<br />Pros<br />Backwards compatible with UML (almost)<br />Package is a kind of Group<br />Element names are now derived attributes<br />Import and Merge operations ironed out<br />Side-effects free<br />Clear conflict detection<br />Aligned with existing and mature international standards<br />Cons<br />UML may ignore it…<br />Future work<br />Synonyms, refinement of operation specifications, fine-tuning of constraints (e.g., name+types), tool support for operations<br />UML “redefines” <br />ECMFA 2011<br />A. Vallecillo: "Improving Naming and Grouping in UML"<br />24<br />

×