Book a Demo

Author Topic: Interface elements on class diagrams  (Read 4827 times)

PaulH

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Interface elements on class diagrams
« on: February 15, 2006, 06:02:10 am »
How do I 'nicely' model multiple classes that implement the same interface.

The restriction on having only one instance of a class on a diagram means that all the realizes lines must point at the same circle, which causes major layout issues.

BTW I would also drop the sterotype <<realizes>> when pointing at an interface in circle mode as it's obvious from context - you already change the line style, so this should be possible.

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Interface elements on class diagrams
« Reply #1 on: February 15, 2006, 01:39:29 pm »
Quote
How do I 'nicely' model ...


That would depend on what fact you are trying to convey.
For example, if its just "who realises this interface", I'd tend to just stick the interface in the middle and add the classes all around like a daisy.
If its something else, then why worry about the realisation.

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.

PaulH

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Interface elements on class diagrams
« Reply #2 on: February 15, 2006, 02:56:22 pm »
I've got a conceptual level model basically showing the inheritance tree, but as I don't want to model using multiple inheritance, I need to show some of the interfaces so it's more obvious what the intended behaviour is.

It's just the usual problem of having to cope with crossing lines in moderately complicated diagrams.

Barry_Pearce

  • EA User
  • **
  • Posts: 70
  • Karma: +0/-0
    • View Profile
Re: Interface elements on class diagrams
« Reply #3 on: February 15, 2006, 03:25:28 pm »
The usual option here is to limit how much you display on a single diagram.

Multiple small diagrams often provide a better means of showing class structure - too often I see, shall we say, people earlier in their OO experience who try to display too much on one diagram.

It must be remebered that the model and the diagrams are separate entities. The model is what is shown in the project view. The diagrams are used to show 'aspects' of that model and the relationships.

In a more complicated package use multiple diagrams - that way no diagram results in 'minute' print sizes when trying to achieve '1 page' diagrams, nor does the reader get lost in a mist of lines.

Hope this helps,
Buzz

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Interface elements on class diagrams
« Reply #4 on: February 15, 2006, 03:41:00 pm »
Quote
I've got a conceptual level model basically showing the inheritance tree, but as I don't want to model using multiple inheritance, I need to show some of the interfaces so it's more obvious what the intended behaviour is.

It's just the usual problem of having to cope with crossing lines in moderately complicated diagrams.
Paul,

Why don't you want to use multiple inheritance?  Especially at the conceptual level?  If you've raised (or considered) the issue, then it's likely to be a significant factor.

EA offers good support for it.  I find it extremely useful and it's at the basis of my policy driven modelling technology.

As Buzz said, by providing small diagrams that only show certain aspects of each class's structurer and relationships you can have the best of both worlds.

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

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: Interface elements on class diagrams
« Reply #5 on: February 16, 2006, 04:36:51 am »
If the problem is too many lines, organising them better may be an option.  You can create and hide line segments, so that there is just a stub of the line on each element with a reference, e.g. "A", "B" etc.. at each end to show which stub goes with which.

Mitch

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Interface elements on class diagrams
« Reply #6 on: February 16, 2006, 07:15:37 am »
Quote
You can create and hide line segments, so that there is just a stub of the line on each element...


How do you create a stub? When I hide the line (right click, Set Visibility->Hide), the line disappears completely.

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: Interface elements on class diagrams
« Reply #7 on: February 16, 2006, 07:33:13 am »
You need to break the line into segments using "Bend line at cursor" first  (even though the line doesn't actually bend when you do this - you need to drag the connection points that have been added to move/bend the line).  

If you add 2 connection points near to their respective elements,  i.e. use "Bend line at cursor" twice you end up with 2 stubs and a middle segment, but with the whole line still intact.   Now point at the middle segment, right-click for the context menu and choose "Suppress line segment".