I need help trying to understand what the meaning of the arrow in a UML Class Diagram is, more specifically in this Composite Diagram. What's the difference between the simple line (from a class to another one) and the arrow (not the inheritance arrow, I refer to the black one)?

UML Class Diagram


2 Answers 2


In order to better discuss the image, I annotated your image with some numbers. Hopefully this will help me be more clear in my writing.

Annotated Class Diagram

There are really three types of lines used here - association (1), composition (4->2), and inheritance (3).

A solid line connecting two classes, such as between Client and BookComponent is simply an association relationship. It is often used to indicate that a class knows about (perhaps as in receives as an argument to a method) or has another class (perhaps as an instance variable). Without any decorations or with an arrow on both ends, the relationship is bidirectional - the two classes share the relationship and know about each other. In some cases, such as line 1 in the figure, the relationship is directional. The Client class knows about BookComponent, but the opposite is not true as BookComponent does not have a or know about Client. Note that there are also other annotations that can appear on association relationships, such as multiplicity or class roles.

The next line is the line that connects BookComposite to BookComponent. It's an association, much like the line between Client and BookComponent. However, the annotations at the points I labeled 2 and 4 add additional information about the relationship. Line in point 1, the arrow at point 2 means the same thing - BookComposite is aware of BookComponent instances, but not the other way around (a directional relationship). The annotation at point 4 indicates an aggregation relationship - BookComposite is a collection of BookComponent. However, it's not a strong relationship (as is the strong composition relationship), so aggregation indicates that a BookComponent can indicate in places outside a BookComposite (you don't need a BookComposite to have a BookComponent).

Something to note is that the arrow used to show directional associations is typically not a solid black arrow as shown in this image. I typically see it as an open arrow that looks more like a v than what is shown in your image.

Finally, the point labeled 3 is the inheritance relationship that you mentioned in your question.

If you're interested in more about UML modeling, I'd recommend purchasing UML Distilled. It's a good book by Martin Fowler that covers class, sequence, object, package, deployment, use case, state machine, activity, communication, composite structure, component, collaboration, interaction overview, and timing diagrams.

  • @ThomasOwens what does it mean for a client to know about the bookcomponent? When is A aware of B? I don't really understand in what direction I should draw the arrows... Dec 11, 2014 at 20:25
  • @user1534664 If A knows about B, then that means A can somehow call methods on B. Usually, that means B is a property of A or B is passed as an argument to a method on B. The arrow direction indicates which direction the interface can be called. An arrow from A pointing to B means that A can use the interface of B (A knows about B).
    – Thomas Owens
    Dec 15, 2014 at 12:06

Your picture shows several different relationships.

The relationship between the Client and BookComponent classes is a Containment relationship. I.e. the Client Contains an instance of BookComponent.

BookComposite and BookComponent has two relationships the open arrowhead is a Generalization relationship (i.e BookComponent generalizes BookComposite or in other terms BookComposite specializes/derives from BookComponent). The closed-arrohead with a diamond at the tail is an Aggregation. That is, BookComposite contains a Collection of BookComponent. The fact that the Diamond is not filled is significant too. It means that the lifecycle of the contained BookComponents is not tied to the life of the containing BookComposite. If it were filled instead of Aggregation, it would be a Composition and when BookComposite was destroyed, so would be the BookComponents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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