Complete Set: All the above, plus the Association
relationship.
The minimal set is the one used by the BlueJ tool
(K¨olling et al., 2003; K¨olling, 2013). The complete
set adds associations, which include simple associa-
tion and also shared and composite aggregation. The
two levels allow the teacher to first introduce the min-
imal set, e.g. using the BlueJ tool, and only latter to
advance to the second one (the complete set), eventu-
ally in a second course.
Next, we list the six Relationships in minimaCD,
contextualised by the respective metamodel, and ac-
companied by the respective graphical notation for
classes A and B (see also the example in Fig. 2):
1. Directed relationships
(DirectedRelationship
Relationship)
(a) Generalization/Inheritance:
(Generalization
DirectedRelationship) (e.g.
between LocalStudent and Student)
(b) Dependency
(Dependency DirectedRelationship)
i. Interface Realization:
(InterfaceRealization Realization
Abstraction Dependency) (e.g. between
Student and Comparable)
ii. Usage (Usage Dependency)
(e.g. between Syllabus e Validator)
2. (Association Relationship) minimalCD only
includes binary associations. Each association
end can have one of the following three values:
(a) Simple Association: (Aggrega-
tionKind=none)(e.g. between Teacher and
Course)
(b) Shared Aggregation: (Aggrega-
tionKind=shared)
(e.g. between Program and Course)
(c) Composite Aggregation:
(AggregationKind=composite)
(e.g. between Course and Syllabus)
The following section presents the respective
mapping from Java
TM
code to minimalCD models.
4 MAPPINGS
When using the minimal set presented in the previ-
ous section, all associations are modelled as generic
dependencies, just like in the BlueJ tool. Here, we
present our proposed mappings for the complete set
where we distinguish three types of association: sim-
ple, composite, and shared. These are the mappings
that should be taught to students as a first step towards
the understanding of relations in class diagrams.
4.1 Associations
An association is the most common way to compose
objects: one object has another one. It seems simple,
but it is not, and for two reasons, which correspond to
two cases:
1. An object can have or be associated to another
object without being part of it. For example, we
say that a teacher has or is associated to courses,
but those courses are not part of the teacher.
2. When we say that one object has another object,
in fact, it has the name of another object, not the
other object itself. That allows that second object
to belong to more than one object.
In the first case, where one object has another ob-
ject that it is not part of the first, we should use a
simple association.
In the second case, when we feel secure to say
that one object is part of another object, our associ-
ation is in fact an aggregation. When in doubt, we
should avoid it and use a ”simple” association, with-
out aggregation. Yet, if we decide that it is in fact an
aggregation (one object is part of another), then we
should decide between two forms:
Shared aggregation The class A object contains (the
name of) one of the class B objects, but with-
out exclusivity. Hence, other objects can contain
the name of the same class B object. As already
shown, this is specified by the addition of a small
unfilled diamond next to the composite object.
Composite aggregation In each instant, only one
class A object contains the name of the classe B
object. This is specified by a small filled rectan-
gle next to the composite object. The composite
object is responsible for the existence and storage
of the component object.
As a general rule, associations are implemented in
code (e.g. Java
TM
) putting object names inside other
ICSOFT2013-8thInternationalJointConferenceonSoftwareTechnologies
280