Author Topic: attribute range and unit; best practice?  (Read 193 times)

Paul Lotz

  • EA User
  • **
  • Posts: 241
  • Karma: +0/-0
    • View Profile
attribute range and unit; best practice?
« on: November 17, 2017, 05:18:00 am »
I have asked related questions about profiles and showing attribute constraints before, but I will take a step back and ask a more basic question.

What is the best practice for showing attribute range (min, max) and unit in UML? (SysML has a somewhat different answer.)

For context, we are modeling signals in a publish-subscribe system. These signals have attributes, and some of these attributes have properties (e.g., a numeric value representing a reference input or a measured value has a range and a unit). I consider these to be invariant constraints defined on the attribute, but I suppose it practically is also possible to model these as tagged values. Does anyone have a suggested best practice?
___
For the record, my baseline is simply to add a set of invariant constraints to each attribute. (These are simple: {unit = m}, {min = 5}, {max = 15}. We parse this ourselves so we don't need to comply with OCL syntax.) The constraints show up fine in the exported UML. A drawback (discussed for years) is that these constraints do not appear on a class diagram in Enterprise Architect.
__

Paul


Paul Lotz

  • EA User
  • **
  • Posts: 241
  • Karma: +0/-0
    • View Profile
Re: attribute range and unit; best practice?
« Reply #2 on: November 17, 2017, 05:50:31 am »
For the record, I submitted a new bug report regarding the inability to display attribute constraints on a class diagram.

Helmut Ortmann

  • EA User
  • **
  • Posts: 884
  • Karma: +37/-1
    • View Profile
Re: attribute range and unit; best practice?
« Reply #3 on: November 21, 2017, 05:43:49 pm »
Hi Paul,

I usually make a profile and define some types with tagged values. These tagged values I can easily visualize on the diagram but it's also possible to use them by Search, Script or Generator. It's easy to assign the type to an Attribute. Then the Attribute has e.g. Unit, range or whatever is important to you.

Usually I call them domain type like 'OutsideTemperature', 'Budget' or 'Money'. I define the tagged values and then I can ensure that every usage has to comply with this definition. Often I use prefixes to label my domain types as 'DomainTypes'.

Best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Richard Freggi

  • EA User
  • **
  • Posts: 43
  • Karma: +1/-1
    • View Profile
Re: attribute range and unit; best practice?
« Reply #4 on: November 21, 2017, 11:13:24 pm »
I suspect that the best practice in UML would be to not display this information unless it was critical to the design concept, in which case Comments (Notes) would be a good way to display this information in a diagram.  See "the elements of UML style", simplicity guidelines: show only what you have to show and Prefer notes over OCL to indicate contstraints.

From memory: if must you can show the element property 'Constraints' page as a note in the diagram I think.  The user manual explains how to do it.