Conceptual Model of UML
Conceptual Model of UML
The Unified Modelling Language (UML) is a standard visual language for describing
and modelling software blueprints. The UML is more than just a graphical language. Stated
formally, the UML is for: Visualizing, Specifying, Constructing, and Documenting.
The artifacts of a software-intensive system (particularly systems built using the object-
oriented style).
1. Language:
It enables us to communicate about a subject which includes the requirements and the system.
It is difficult to communicate and collaborate for a team to successfully develop a system
without a language.
2. Model:
It is a representation of a subject.
It captures a set of ideas (known as abstractions) about its subject.
3. Unified:
It is to bring together the information systems and technology industry’s best engineering
practices.
These practices involve applying techniques that allow us to successfully develop systems.
AConceptualModel:
A conceptual model of the language underlines the three major elements:
• The Building Blocks
• The Rules
• Some Common Mechanisms
Once you understand these elements, you will be able to read and recognize the models as
well as create some of them.
1. Structural things
2. Behavioural things
3. Grouping things
4. Annotational things
These things are the basic object-oriented building blocks of the UML. You use
them to write well-formed models.
2. Relationships:
There are 4 kinds of relationships in the UML:
1. Dependency
2. Association
3. Generalization
4. Realization
These relationships are the basic relational building blocks of the UML.
Diagrams:
It is the graphical presentation of a set of elements. It is rendered as a connected
graph of vertices (things) and arcs (relationships).
1. Class diagram
2. Object diagram
3. Use case diagram
4. Sequence diagram
5. Collaboration diagram
6. Statechart diagram
7. Activity diagram
8. Component diagram
9. Deployment diagram
Rules:
The UML has a number of rules that specify what a well-formed model should look like. A
well-formed model is one that is semantically self-consistent and in harmony with all its
related models.
The UML has semantic rules for:
Names – What you can call things, relationships, and
diagrams.
Scope – The context that gives specific meaning to a name.
Visibility – How those names can be seen and used by
others.
Integrity – How things properly and consistently relate to
one another.
Execution – What it means to run or simulate a dynamic
model.
CommonMechanisms:
The UML is made simpler by the four common mechanisms. They are as follows:
1. Specifications
2. Adornments
3. Common divisions
4. Extensibility mechanisms
A use case diagram is used to represent the dynamic behaviour of a system. It encapsulates
the system's functionality by incorporating use cases, actors, and their relationships. It models
the tasks, services, and functions required by a system/subsystem of an application. It depicts
the high-level functionality of a system and also tells how the user handles a system.
The main purpose of a use case diagram is to portray the dynamic aspect of a system. It
accumulates the system's requirement, which includes both internal as well as external
influences. It invokes persons, use cases, and several things that invoke the actors and
elements accountable for the implementation of use case diagrams. It represents how an
entity from the external environment can interact with a part of the system.
It is essential to analyse the whole system before starting with drawing a use case diagram,
and then the system's functionalities are found. And once every single functionality is
identified, they are then transformed into the use cases to be used in the use case diagram.
After that, we will enlist the actors that will interact with the system. The actors are the
person or a thing that invokes the functionality of a system. It may be a system or a private
entity, such that it requires an entity to be pertinent to the functionalities of the system to
which it is going to interact.
Once both the actors and use cases are enlisted, the relation between the actor and use case/
system is inspected. It identifies the no of times an actor communicates with the system.
Basically, an actor can interact multiple times with a use case or system at a particular
instance of time.
Following are some rules that must be followed while drawing a use case diagram:
1. A pertinent and meaningful name should be assigned to the actor or a use case of a
system.
2. The communication of an actor with a use case must be defined in an understandable
way.
3. Specified notations to be used as and when required.
4. The most significant interactions should be represented among the multiple no of
interactions between the use case and actors.
A use case diagram depicting the Online Shopping website is given below.
Here the Web Customer actor makes use of any online shopping website to purchase online.
The top-level uses are as follows; View Items, Make Purchase, Checkout, Client Register.
The View Items use case is utilized by the customer who searches and view products.
The Client Register use case allows the customer to register itself with the website for
availing gift vouchers, coupons, or getting a private sale invitation. It is to be noted that
the Checkout is an included use case, which is part of Making Purchase, and it is not
available by itself.
The View Items is further extended by several use cases such as; Search Items, Browse
Items, View Recommended Items, Add to Shopping Cart, Add to Wish list. All of these
extended use cases provide some functions to customers, which allows them to search for an
item. The View Items is further extended by several use cases such as; Search Items, Browse
Items, View Recommended Items, Add to Shopping Cart, Add to Wish list. All of these
extended use cases provide some functions to customers, which allows them to search for an
item.
Both View Recommended Item and Add to Wish List include the Customer Authentication
use case, as they necessitate authenticated customers, and simultaneously item can be added
to the shopping cart without any user authentication.
Similarly, the Checkout use case also includes the following use cases, as shown below. It
requires an authenticated Web Customer, which can be done by login page, user
authentication cookie ("Remember me"), or Single Sign-On (SSO). SSO needs an external
identity provider's participation, while Web site authentication service is utilized in all these
use cases.
The Checkout use case involves Payment use case that can be done either by the credit card
and external credit payment services or with PayPal.
Important tips for drawing a Use Case diagram
Following are some important tips that are to be kept in mind while drawing a use case
diagram:
A use case diagram should represent the most significant interaction among the multiple
interactions.
At least one module of a system should be represented by the use case diagram.
If the use case diagram is large and more complex, then it should be drawn more generalized.
Sequence Diagram
The sequence diagram represents the flow of messages in the system and is also termed as an
event diagram. It helps in envisioning several dynamic scenarios. It portrays the
communication between any two lifelines as a time-ordered sequence of events, such that
these lifelines took part at the run time. In UML, the lifeline is represented by a vertical bar,
whereas the message flow is represented by a vertical dotted line that extends across the
bottom of the page. It incorporates the iterations as well as branching.
Lifeline
Actor
A role played by an entity that interacts with the subject is called as an actor. It is out of the
scope of the system. It represents the role, which involves human users and external hardware
or subjects. An actor may or may not represent a physical entity, but it purely depicts the role
of an entity. Several distinct roles can be played by an actor or vice versa.
Activation
It is represented by a thin rectangle on the lifeline. It describes that time period in which an
operation is performed by an element, such that the top and the bottom of the rectangle is
associated with the initiation and the completion time, each respectively.
Messages
The messages depict the interaction between the objects and are represented by arrows. They
are in the sequential order on the lifeline. The core of the sequence diagram is formed by
messages and lifelines.
Note
A note is the capability of attaching several remarks to the element. It basically carries useful
information for the modelers.
Sequence Fragments
Sequence fragments have been introduced by UML 2.0, which makes it quite easy for the
creation and maintenance of an accurate sequence diagram.
Types of fragments
alt Alternative multiple fragments: The only fragment for which the condition is true, will
execute.
opt Optional: If the supplied condition is true, only then the fragments will execute. It is
similar to alt with only one trace.
loop Loop: Fragments are run multiple times, and the basis of interaction is shown by the
guard.
region Critical region: Only one thread can execute a fragment at once.
Any online customer can search for a book catalogue, view a description of a particular book,
add a book to its shopping cart, and do checkout.
Benefits of a Sequence Diagram
It is easy to generate.
In the case of too many lifelines, the sequence diagram can get more complex.
The incorrect result may be produced, if the order of the flow of messages changes.
Since each sequence needs distinct notations for its representation, it may make the
diagram more complex.
The class diagram depicts a static view of an application. It represents the types of objects
residing in the system and the relationships between them. A class consists of its objects, and
also it may inherit from other classes. A class diagram is used to visualize, describe,
document various different aspects of the system, and also construct executable software
code.
It shows the attributes, classes, functions, and relationships to give an overview of the
software system. It constitutes class names, attributes, and functions in a separate
compartment that helps in software development. Since it is a collection of classes, interfaces,
associations, collaborations, and constraints, it is termed as a structural diagram.
The main purpose of class diagrams is to build a static view of an application. It is the only
diagram that is widely used for construction, and it can be mapped with object-oriented
languages. It is one of the most popular UML diagrams. Following is the purpose of class
diagrams given below:
o Upper Section: The upper section encompasses the name of the class. A class is a
representation of similar objects that shares the same relationships, attributes,
operations, and semantics. Some of the following rules that should be taken into
account while representing a class are given below:
o Middle Section: The middle section constitutes the attributes, which describe the
quality of the class. The attributes have the following characteristics:
The attributes are written along with its visibility factors, which are public (+), private (-),
protected (#), and package (~).
A meaningful name should be assigned to the attribute, which will explain its usage inside the
class.
o Lower Section: The lower section contains methods or operations. The methods are
represented in the form of a list, where each method is written in a single line. It
demonstrates how a class interacts with data.
Relationships
The company encompasses a number of employees, and even if one employee resigns, the
company still exists.
A contact book consists of multiple contacts, and if you delete the contact book, all the
contacts will be lost.
Abstract Classes
In the abstract class, no objects can be a direct entity of the abstract class. The abstract class
can neither be declared nor be instantiated. It is used to find the functionalities across the
classes. The notation of the abstract class is similar to that of class; the only difference is that
the name of the class is written in italics. Since it does not involve any implementation for a
given function, it is best to use the abstract class with multiple objects.
Let us assume that we have an abstract class named displacement with a method declared
inside it, and that method will be called as a drive (). Now, this abstract class method can be
implemented by any object, for example, car, bike, scooter, cycle, etc.
The class diagram is used most widely to construct software applications. It not only
represents a static view of the system but also all the major aspects of an application. A
collection of class diagrams as a whole represents a system.
Some key points that are needed to keep in mind while drawing a class diagram are given
below:
o Notes can be used as and when required by the developer to describe the aspects of a
diagram.
o The diagrams should be redrawn and reworked as many times to make it correct
before producing its final version.
The class diagram is used to represent a static view of the system. It plays an essential role in
the establishment of the component and deployment diagrams. It helps to construct an
executable code to perform forward and backward engineering for any system, or we can say
it is mainly used for construction. It represents the mapping with object-oriented languages
that are C++, Java, etc. Class diagrams can be used for the following purposes:
State chart diagram is one of the five UML diagrams used to model the dynamic nature of a
system. They define different states of an object during its lifetime and these states are
changed by events. State chart diagrams are useful to model the reactive systems. Reactive
systems can be defined as a system that responds to external or internal events.
State chart diagram describes the flow of control from one state to another state. States are
defined as a condition in which an object exists and it changes when some event is triggered.
The most important purpose of State chart diagram is to model lifetime of an object from
creation to termination.
State chart diagrams are also used for forward and reverse engineering of a system. However,
the main purpose is to model the reactive system.
State chart diagram is used to describe the states of different objects in its life cycle.
Emphasis is placed on the state changes upon some internal or external events. These states
of objects are important to analyse and implement them accurately.
o Initial state: It defines the initial state (beginning) of a system, and it is represented
by a black filled circle.
o Final state: It represents the final state (end) of a system. It is denoted by a filled
circle present within a circle.
o Decision box: It is of diamond shape that represents the decisions to be made on the
basis of an evaluated guard.
o Transition: A change of control from one state to another due to the occurrence of
some event is termed as a transition. It is represented by an arrow labelled with an
event due to which the change has ensued.
State chart diagrams are very important for describing the states. States can be identified as
the condition of objects when a particular event occurs.
Before drawing a state chart diagram, we should clarify the following points −
Following is an example of a state chart diagram where the state of Order object is analysed
The first state is an idle state from where the process starts. The next states are arrived for
events like send request, confirm request, and dispatch order. These events are responsible for
the state changes of order object.
During the life cycle of an object (here order object) it goes through the following states and
there may be some abnormal exits. This abnormal exit may occur due to some problem in the
system. When the entire life cycle is complete, it is considered as a complete transaction as
shown in the following figure. The initial and final state of an object is also shown in the
following figure.
Where to Use State chart Diagrams?
From the above discussion, we can define the practical applications of a state chart diagram.
State chart diagrams are used to model the dynamic aspect of a system like other four
diagrams discussed in this tutorial. However, it has some distinguishing characteristics for
modelling the dynamic nature.
State chart diagram defines the states of a component and these state changes are dynamic in
nature. Its specific purpose is to define the state changes triggered by events. Events are
internal or external factors influencing the system.
State chart diagrams are used to model the states and also the events operating on the system.
When implementing a system, it is very important to clarify different states of an object
during its life time and State chart diagrams are used for this purpose. When these states and
events are identified, they are used to model it and these models are used during the
implementation of the system.
If we look into the practical implementation of State chart diagram, then it is mainly used to
analyse the object states influenced by events. This analysis is helpful to understand the
system behaviour during its execution.