3

I want to draw a class diagram that shows the following for an application:

  • An external content management system that publishes some news items.
  • The class that represents the news item in my application.

The question is shall I include the external content management system as a class in my diagram (and maybe give it a different color or add a comment that it is an external component) ?

if the answer is no, what shall I include in the class diagram ? the news item class only ? and how to show the relation between the news item class and the external content management system ?

0

3 Answers 3

5

Your external API (the connection to the content management system) is not a class, it's an interface. As illustrated in this Stack Overflow question, it would look something like this:

enter image description here

4

I work at a Fortune 100 company as a Senior Architect. We're about as uptight about UML as you find in the industry, and we don't worry about these kinds of things.

Basically, if including an external system (typically using a separate package notation) helps explain something, then include it. If it is just there for some insignificant corner case that nobody's going to care about, leave it off.

UML exists primarily as a communication tool. The point is to be able to have diagrams that explain important features of a system. So, when deciding to include or ignore any feature in any UML diagram, your first question should be: "Is this thing necessary for describing the important aspects of my system, given this diagram's purpose?" (Various UML diagrams have different purposes, so something can legitimately be ignored in one, and included in another.)

2

If the relations with the classes from the external system are relevant for what you want to show in the class diagram, then you should show them by all means.

The standard UML way to show that some classes belong to a different module/system/whatever is to put them in a different package. In your diagram, you can either draw the classes within a package symbol for the external system, or you can use fully-qualified names (<external system name>::<class name>) for those classes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.