Challenges in Developing Sequence Diagrams (UML)
Challenges in Developing Sequence Diagrams (UML)
Abstract. During the object-oriented software design phase, the designers have
to describe the dynamic aspect of the system under development through the most
common interaction diagram variant in UML 2.0, i.e. sequence diagrams. Some
novice designers, including undergraduate and postgraduate students, suffer from
making inappropriate models due to insufficiently detailed guidance required to
develop such sequence diagrams. This paper classifies some potential mistakes
which are likely performed by such novice designers, and discusses the
corresponding corrections. We summarized such mistakes based on our long
experiences in teaching software modeling classes as well as software analysis
and design classes. There were classified twenty-one potential mistakes with
respect to the syntactical and semantical correctness of the developed models. It
is concluded that novice designers have to be aware and take into account the
identified mistakes in such a way they can produce correct sequence diagrams.
1 Introduction
Unified Modeling Language (UML) is widely used in software development
practices [1] [2] [3] [4]. A recent survey placed Python and Java, regarded as object-
oriented programming languages, at the top rank of programming languages [5],
which, in turn, requires UML for software modeling at the software analysis and
design phases. As such, UML becomes a de-facto modeling language for object-
oriented software systems. Since its first release in 1997, Object Management
Group (OMG) maintains eleven UML specifications, including the latest release,
i.e. version 2.5.11. UML provides several diagrams categorized into two major kinds
of diagram types, i.e. structure diagrams and behavior diagrams [6]. Structure
diagrams represent the static aspect of the system under development, while
behavior diagrams abstract the dynamic aspect. Sequence diagrams are widely used
to describe such a dynamic aspect, which represent the time ordering of messages
interchanged between objects [6] [7].
Based on our experiences in teaching software analysis and design classes as
well as software modeling classes in undergraduate and/or postgraduate degrees for
more than ten years, we observed some mistakes that are likely made by the
1
Website: http://www.omg.org/spec/UML/2.5.1
222 JITeCS Volume 5, Number 2, August 2020, pp 221-234
object is placed on the right side of the other object which initiates further
interaction. Messages are placed along the Y-axis, going down to represent an
increasing time. A complete sequence diagram is outlined in a frame whose name
represents the use case being described.
Objects are classified into three stereotypes, i.e. boundary, entity, and control,
initially introduced by Jacobson [15] [16], even OMG specifies such objects in
general [6]. A boundary (or interface) object manages communication between
actors and the system under development. Each actor requires its own boundary
object for its action on the system [16]. The boundary objects are identified from
the use case scenario. An entity object represents persistent information handled by
the system, which usually corresponds to a particularly relevant concept or thing in
real life. It is obvious to identify entity objects from the use case scenario derived
from the problem domain. It is noted that one use case represents one specific
function in the software system. In such a function, a control object manages the
interaction/logical flow of one use case scenario (one software function). It plays a
glue between boundary and entity objects [15]. In a sequence diagram, we may have
more than one boundary and entity objects. However, one control object per use
case is recommended.
Decorating object in the diagram is essential for better understanding. Each
object is labeled at the bottom by its corresponding class or actor. The colon at each
label represents an instance of a class or actor. Any name placed before the colon
indicates the specified object name. We may a particular name at each object as
required. Each object has its own lifeline describing the time-line for a process or
the life of the object during a sequence [6] [14]. On a lifeline, there exist execution
occurrences (or focus of controls [2] [7]) denoting the start or the end events of
execution, i.e. sending or receiving messages.
Messages convey information interchanged between related objects. The
synchronous messages are commonly used in a sequence diagram, instead of
asynchronous ones. Messages, as shown di Fig. 1, are examples of synchronous
messages using a filled arrowhead [6]. Once a message sent from the first object to
the second object, there exists a method invocation at the second object by the first
object. As such, the message label denotes a method name at the receiving object,
which must be in a verb form. A self-message is similar to such synchronous
messages with a special case in which the method invocation occurs in the same
object. Creation messages are used for object instantiations, which correspond to a
constructor method in a class. A reply message delivers information replied by the
receiving object, which is labeled by the value being returned. Such a reply message
must be placed instantaneously below a related message, if needed. Some methods
have a return value, and some others are not. If a method has a return value, then
the diagrams must show it as a reply message; otherwise, it needs not to be drawn.
Combined fragments represent a set of object interactions according to a
particular condition represented by its operator. Such fragments may improve the
readability of the diagram. The operators include alt (alternatives, representing an
XOR behavior choice), opt (option, denoting a choice behavior based on the only
true condition), loop (loop, describing an iterative behavior), and ref (reference,
depicting a go-to another sequence diagram behavior) [2] [6]. A guard may involve
in a certain operator, which is a basis for evaluating the subsequent interaction flow.
Concerning object interactions, there should be a pattern to follow such that
change complexity [16] and object responsibilities [2] can be proportionally
managed. We construct the following four rules adapted mainly from Rosenberg’s
work [15] with some adjustments based on Larman’s work [2]:
- Rule 1: Actor objects can send messages only to boundary objects. Such
messages (i.e. synchronous) represent instructions to be performed by the
system.
- Rule 2: Boundary objects can send messages to control and actor objects.
Messages (i.e. synchronous) sent to control objects denote instructions to be
performed by such control objects. Messages sent to actor objects represent
information to the actor objects, which may then affect their behaviors.
- Rule 3: Entity objects can send messages to control objects as well as to entity
objects. Messages sent to control objects specify a return value of a received
message from such control objects, i.e. reply messages. Messages delivered to
other entity objects denote instructions to be performed by such objects
according to the responsibility patterns, e.g. Creator, Information Expert [2].
- Rule 4: Control objects can send messages to boundary, entity, and control
objects. Messages (i.e. synchronous) sent to boundary objects represent
instructions to boundary objects for displaying particular information. Messages
(i.e. synchronous) delivered to entity objects denote instructions to be performed
by such entity objects. If the interaction flow is too complicated, we may
delegate some responsibilities from a control object to another control object by
sending a message (i.e. synchronous).
concepts. As sequence diagram modeling relies on use case scenario [2], it refers to
Jacobson’s objectory approach [15] [16]. Such an approach classifies objects into
three stereotypes, i.e. entity, control, boundary, which is then known as the ECB
(entity-control-boundary) approach. There exist object interaction rules in ECB
[15], which differ from MVC. Further, the control object in ECB is part of the
domain layer or business logic and coordinates works requested by actors through
the boundary object. In comparison, the controller object in MVC is part of the UI
layer and manages UI interactions.
Fig. 3. Class naming convention in a noun form: (a) wrong representation; (b) correction
Fig. 6. Messages in intructional verb forms: (a) wrong representation; (b) correction
3.9 The same boundary object handles messages from various actors in
different interactions
Novice designers often think a boundary object can be used in many different use
case scenarios since such a boundary object conveys substantially similar
information to its actor objects. In the implementation stage, such an approach may
be valid. We, however, have to be careful if we deal with modeling since each
boundary object has its own corresponding generated events associated with their
relevant boundary object elements, such as buttons, links. Correcting this mistake,
we should have dedicated boundary objects at each use case scenario or interaction.
Fig. 10. High coupling interactions: (a) wrong representation; (b) correction
scenarios. In such scenarios, we do not deal with any detail within the system under
development, including specific databases or tables. We just introduce all relevant
objects which exist in the problem domain and involve in such scenarios. Every
object in the sequence diagram represents a single object instantiated from a
particular class. Fig. 11a shows an entity object Registrant Table, which is an
inappropriate entity object due to it should be absent in the use case scenario. Fig.
11b illustrates the correct entity object Registrant, which relevant to the use case
scenario. Further, it is noted that the entity object Registrant represents a single
object registrant, while Registrant Table denotes a set of registrants.
Fig. 11. Entity object representation: (a) wrong representation; (b) correction
recognizable than message doAct(), while parameters arg1 and arg2 are
required by such message.
Fig. 12. Specific guard information: (a) wrong representation; (b) correction
3.18 Diagram does not represent all flows described in the use case
scenario
Each sequence diagram represents the logical flows that occur in a particular use
case scenario, including basic and alternative flows. In some cases, we only
illustrate the basic flow in the diagram, ignoring entirely or partly the alternative
flows. Correcting this, we have to draw all flows described in the use case scenario.
Fig. 13. Boundary object interactions: (a) wrong representation; (b) correction
3.21 A sending object does not receive a reply message from the
corresponding receiving object
A reply message occurs when an invoked method at the receiving object has a return
value. Such a reply message should be drawn from the receiving object to the
sending object. The sending object refers to the object that performs such method
invocation. Fig. 15a illustrates the wrong diagram in which the entity object sends
the reply message retVal to the boundary object in response to message doAct2.
The boundary object, as the sending object, should receive a reply message from
the control object, as the receiving object, in response to message doAct2. Similarly,
the control object should receive a reply message from the entity object in response to the
message doAct3. Further, Fig. 15a violates Rule 3 since the entity object directly
sends a message to the boundary object. Fig. 15b depicts the correct diagram
involving two reply messages which are sent in sequence to the corresponding
Fig. 15. Reply messages flows: (a) wrong representation; (b) correction
4 Conclusion
We have classified twenty-one potential mistakes, which are likely made by the
students as novice designers in developing sequence diagrams based on the
specification of UML 2.0 and related works of the literature. They have to be aware
of such mistakes if they need to produce such sequence diagrams, which are
syntactically and semantically correct. Building correct models become a critical
task in software development practices as a way to understand the system under
development in a particular aspect. Finally, high-quality software relies on its all
related correct models describing various aspects of the system.
References
9. B. Unhelkar, Verification and validation for quality of UML 2.0 models, Wiley
Online Library. (2005)
10. O. I. Lindland, G. Sindre, and A. Solvberg, “Understanding Quality in
Conceptual Modeling,” IEEE Software, vol. 11, no. 2, pp. 42-49. (1994)
11. T. Tamai, “How to Teach Software Modeling,” in The 27th International
Conference on Software Engineering. (2005)
12. L. Kuzniarz and M. Staron, “Best practices for teaching UML based software
development,” in International Conference on Model Driven Engineering
Languages and Systems. (2005)
13. B. Westphal, “Teaching Software Modelling in an Undergraduate Introduction
to Software Engineering,” in 2019 ACM/IEEE 22nd International Conference
on Model Driven Engineering Languages and Systems Companion (MODELS-
C). (2019)
14. A. Dennis, B. H. Wixom, and D. Tegarde, Systems Analysis and Design with
UML Version 2.0: An Object-Oriented Approach, John Wiley & Sons, Inc.
(2005)
15. D. Rosenberg and K. Scott, Use Case Driven Object Modeling with UML: A
Practical Approach, Addison-Wesley. (1999)
16. I. Jacobson, Object-oriented software engineering: a use case driven approach,
New York: ACM Press. (1992)
17. M. Grossman, J. E. Aronson, and R. V. McCarthy, “Does UML make the
grade? Insights from the software development community,” Information and
Software Technology, vol. 47, no. 6, pp. 383-397. (2005).