Book a Demo

Author Topic: Derived and Non-Derived Attribute  (Read 15368 times)

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Derived and Non-Derived Attribute
« on: December 15, 2009, 03:10:57 am »
Say you have a Class with three attributes a, b and c.  Also say it is true that a + b = c.

I want a user to be able to enter any two values and have the system calculate the third.  So this means that all attributes can be both derived and non-derived (entered by the user).

How do I correctly model this?  Can a single attribute be both derived and non-derived?   :-?

Thanks.
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Derived and Non-Derived Attribute
« Reply #1 on: December 15, 2009, 09:04:06 am »
I think I found my answer.  Martin Fowler says in UML Distilled, 3rd Edition (p. 69);

"My preferred thinking is that it [a derived attribute] indicates a constraint between values. In this case, we are saying that the constraint among the three values holds, but it isn't important which of the three values is computed. In this case, the choice of which attribute to mark as derived is arbitrary and strictly unnecessary, but it's useful to help remind people of the constraint."

He then marks any one of the three attributes as derived, and puts the constraint on the class (not on one or more of the attributes).

Works for me!  Cheers.   ;D
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Derived and Non-Derived Attribute
« Reply #2 on: December 15, 2009, 09:40:17 am »
Quote
[size=18]...[/size]
He then marks any one of the three attributes as derived, and puts the constraint on the class (not on one or more of the attributes).
Hi Dorian,

I'd mark all three attributes as derived, with the appropriate form of the derivation for each attribute, in addition to the class level constraint.  Otherwise, how are you communicating that any two of the three can be entered and the third derived?

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

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Derived and Non-Derived Attribute
« Reply #3 on: December 15, 2009, 10:03:31 am »
OK I'll mark all three derived, thanks Paolo.

What do you mean by 'appropriate form of the derivation' please?
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Derived and Non-Derived Attribute
« Reply #4 on: December 15, 2009, 11:24:43 am »
Quote
OK I'll mark all three derived, thanks Paolo.

What do you mean by 'appropriate form of the derivation' please?
You're proposing to take advantage of mathematical commutations:  if c=a + b, then b = c- a and a = c - b.  So each attribute is defined as derived and it's derivation specifically addressed.

Now, I'd also add a note on the class constraint mentioning all this and indicating the effect you expect on the UI.

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

Dorian Workman

  • EA User
  • **
  • Posts: 194
  • Karma: +0/-0
    • View Profile
Re: Derived and Non-Derived Attribute
« Reply #5 on: December 15, 2009, 02:14:31 pm »
Gotcha.  Thanks.
<a href="http://www.linkedin.com/in/dorianworkman" ><img src="http://www.linkedin.com/img/webpromo/btn_liprofile_blue_80x15.gif" width="80" height="15" border="0" alt="View Dorian Workman