Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: PaulH on February 15, 2006, 06:02:10 am

Title: Interface elements on class diagrams
Post by: PaulH 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.
Title: Re: Interface elements on class diagrams
Post by: sargasso 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
Title: Re: Interface elements on class diagrams
Post by: PaulH 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.
Title: Re: Interface elements on class diagrams
Post by: Barry_Pearce 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
Title: Re: Interface elements on class diagrams
Post by: Paolo F Cantoni 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
Title: Re: Interface elements on class diagrams
Post by: Graham_Moir 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.
Title: Re: Interface elements on class diagrams
Post by: Mitch 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.
Title: Re: Interface elements on class diagrams
Post by: Graham_Moir 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".