Author Topic: Unique Element Names within Package  (Read 4800 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Unique Element Names within Package
« on: August 11, 2009, 04:20:47 pm »
Hey everyone,


This feature takes off from a discussion regarding namespaces and uniqueness of element names that came up in http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1249546103.

EA does not enforce unique element names within a package, and I'm pretty sure it cannot do so and remain UML compliant. The standard only says that an element must have a name, it doesn't say anything about uniqueness.

However, names within a context do need to be unique in order for the model to be properly understood - either by a person or by a compiler.

So I propose adding an Object option, "Warn about duplicate element names", which would flash a confirmation dialog whenever you tried to give an element a name that another element in the same context already has, ie element in package, class in outer class, etc.
This would apply to name entry during create/rename, as well as when moving an element from one context to another. You wouldn't want it during imports, although perhaps it might be useful to see a list of such offending elements in the import output.

In addition, a model validation rule should be added to check for uniqueness of element names within each context.

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Unique Element Names within Package
« Reply #1 on: August 11, 2009, 05:03:51 pm »
Well presented!

Gets my vote!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Unique Element Names within Package
« Reply #2 on: August 11, 2009, 05:30:38 pm »
Gets my vote if we rephrase that to:
"Element name must be unique within namespace"
In this case the "Namespace" refers to the UML concept of namespace (not the EA Code Engineering concept) as this is a well defined concept within UML that enforces this rule.
We might even go further and not allow duplicate names within a namespace when the option "Strict UML syntax" is selected.

Geert

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Unique Element Names within Package
« Reply #3 on: August 11, 2009, 10:30:16 pm »
But clearing the strict UML option (or some other means) should disable this check. The result of doing so would be that EA would work as it does now.
No, you can't have it!