Module2 (1)
Module2 (1)
Module2 (1)
Module II
Concept of unified modelling language, Object Oriented Analysis and Design using
UML, UML Diagrams: Class Diagram, representing various features of a class,
messages, use case diagram, identifying use cases, examples.
Why models?
The Unified Modeling Language (UML) is a graphical language for visualizing, specifying,
constructing, and documenting the artifacts of a software-intensive system. The UML offers
a standard way to write a system’s blueprints, including conceptual things such as business
processes and system functions as well as concrete things such as programming language
statements, database schemas, and reusable software components.
The Unified Modelling Language (UML) is an industry standard for object oriented design
notation, supported by the Object Management Group (OMG).
1
Object Oriented Analysis and Design
• The UML builds models that are precise, unambiguous, and complete.
Diagrams
UML Diagrams
2
Object Oriented Analysis and Design
Class Diagram
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.
3
Object Oriented Analysis and Design
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 are the purpose of class
diagrams given below:
1. 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:
• Capitalize the initial letter of the class name.
• Place the class name in the center of the upper section.
4
Object Oriented Analysis and Design
Relationships
5
Object Oriented Analysis and Design
6
Object Oriented Analysis and Design
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 differ ence 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.
7
Object Oriented Analysis and Design
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:
8
Object Oriented Analysis and Design
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 c an 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:
A use case diagram is used to represent the dynamic behavior 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.
9
Object Oriented Analysis and Design
It is essential to analyze 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:
• A pertinent and meaningful name should be assigned to the actor or a use case of a
system.
• The communication of an actor with a use case must be defined in an understandable
way.
• Specified notations to be used as and when required.
• 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.
10
Object Oriented Analysis and Design
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.
11
Object Oriented Analysis and Design
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.
12
Object Oriented Analysis and Design
Following are some important tips that are to be kept in mind while drawing a use case
diagram:
13