What if you have two classes and there are more than one type of lines that can be drawn between them, for instance there might be an association relationship as well as an aggregation between the two classes.

Can I show multiple of these relationships between two classes that I've modelled on a class diagram?

Recommended Answers

All 2 Replies

What are you using for your UML modeling tool? In any case, most such tools with which I am familiar (most of them) will let you make multiple connections between two classes. After all, that is not a totally unknown requirement, such as modeling a binary tree, where you have a node, and connections to a left and a right node of the same class. So, in that case you have multiple connections from one class to itself. That is another, more extreme, form of this problem. So, if your modelling tool does not allow such, ditch it for one that does!

I just tested this out using my modeling tool - Sparx Systems' Enterprise Architect - which I have been using for major systems development for 6 years now, and it handles it without problems.

So, even if you are manually drawing such models using some sort of drawing tool, you can do this.

Actually, I'm doing some research for an exam for which I'll probably have to model a class based on some descriptions of software requirements.

I've always been curious whenever I see some UML class diagrams they do not usually have more than one connection between the same two classes and I'm just wondering whether that means you can't have them. From the softwares I've worked on - it would make logical sense for there to be multiple connections but I don't want to get marked down so I might just leave it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.