Book a Demo

Author Topic: How to show constraints?  (Read 6474 times)

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
How to show constraints?
« on: April 11, 2005, 01:03:15 pm »
I can add a constraint to a class thru a class' properties dialog, on the "Constraints" tab.
Constraints added this way don't appear on the diagram.

I can also add a constraint to a class by right-clicking it and choosing "Attach / Attach Constraint". But constraints added this way don't appear on the class' properties.

Why are there two kinds of constraints? What is the difference between them?

Thanks.
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer

thomaskilian

  • Guest
Re: How to show constraints?
« Reply #1 on: April 11, 2005, 01:11:46 pm »
You can show class constraints in the diagram: Select diagram properties; check "Show constraints".

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: How to show constraints?
« Reply #2 on: April 11, 2005, 01:16:07 pm »
Thanks, but I still don't understand the difference between these two types of constraints.
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer

thomaskilian

  • Guest
Re: How to show constraints?
« Reply #3 on: April 11, 2005, 01:20:20 pm »
Hmm. Hard to tell. There are similar differences in requirement, to do's, issues a.s.o. The attached note gives you a relation and some separate element whilst the class constraint is mor like a property. I also would like to have all of these more straightforeward than this double action  :-/

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: How to show constraints?
« Reply #4 on: April 11, 2005, 01:28:53 pm »
I think they should all be (classes', in this example) properties. Should I file a bug report against this?

Are you (Thomas) an EA employee, or an EA user?
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: How to show constraints?
« Reply #5 on: April 11, 2005, 03:53:25 pm »
The difference between innies and outies! ::)

In general all constraints on a class should be created and managed within the class properties.

However, there are times when a constraint applies to the context for which the diagram was created and is not a constraint to be applied to the class in general.  I cant think of a salient generalised example here, you'll have to use your imagination.

Secondly, there are instances where a constraint does not apply to a single class but exists as a constraint on a structure created by the co-existence of two or more classes on the same diagram - simple example being mutual exclusivity (a "co-singleton"??).

Ergo "outey" constraints do have their places.

hth
bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: How to show constraints?
« Reply #6 on: April 11, 2005, 04:09:43 pm »
I see. Thanks for the clarification. Maybe your explanation should be in EA's docs?  :P
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer

thomaskilian

  • Guest
Re: How to show constraints?
« Reply #7 on: April 12, 2005, 12:51:29 am »
Hi dserodio,
I'm just a user like you. Sparx stuff can be recognized at the 5 red stars. Regarding the documentation: it's already a 1000 pages. Surely you would not have found the explanation if it was inside ;) Most times it's easier to ask the forum.

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: How to show constraints?
« Reply #8 on: April 12, 2005, 10:56:47 am »
Can constraints created and managed within the class properties be shown on the diagram as a "Note", instead of in a compartment in the class?.
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: How to show constraints?
« Reply #9 on: April 12, 2005, 04:15:28 pm »
Yes they can and I reckon this is one of the best things I have seen in EA.

Just create a blank note in the diagram and link it to the class using a note link.  Then right click on the note link, you will see a menu item Link This Note to an Element Feature...

Explore - enjoy.

bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: How to show constraints?
« Reply #10 on: April 12, 2005, 04:17:23 pm »
Quote
Can constraints created and managed within the class properties be shown on the diagram as a "Note", instead of in a compartment in the class?


Yes. Add a note to your diagram then draw a note link from note to class. Right-click the note link and select "Link this note to an element feature". For Feature Type choose "Constraint" and choose the constraint you want to display from the list.

UPDATE: Bruce has beaten me to it and somebody has already posted the same answer in a different thread. Oh well...  :'(
« Last Edit: April 12, 2005, 04:22:39 pm by KP »
The Sparx Team
[email protected]

dserodio

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: How to show constraints?
« Reply #11 on: April 13, 2005, 07:48:35 am »
Great! Thanks for the tip. I don't mean to be picky, but shouldn't this note have a "invariant", "pre-condition", etc stereotype? I think it would communicate better.
Correctness is clearly the prime quality. If a system does not do what it is supposed to do, then everything else about it matters little. - Bertrand Meyer