0% found this document useful (0 votes)
60 views56 pages

Object-Oriented Programming (BSIT-2101) : Junar A. Landicho

This document provides an overview of the Unified Modeling Language (UML) and UML diagrams. It discusses what UML is, the different types of UML diagrams including structural diagrams, behavior diagrams, and interaction diagrams. It also explains key elements of class diagrams such as class name, attributes, operations, and relationships. The document contains examples of a UML class diagram and provides guidance on how to read and interpret class diagrams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views56 pages

Object-Oriented Programming (BSIT-2101) : Junar A. Landicho

This document provides an overview of the Unified Modeling Language (UML) and UML diagrams. It discusses what UML is, the different types of UML diagrams including structural diagrams, behavior diagrams, and interaction diagrams. It also explains key elements of class diagrams such as class name, attributes, operations, and relationships. The document contains examples of a UML class diagram and provides guidance on how to read and interpret class diagrams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Object-oriented Programming

(BSIT-2101)
Junar A. Landicho
[email protected]

People are doubting how
far you can go, go so far
that you can't hear them
anymore”

Michele Ruiz

Topic 6:
The Unified
Modelling
Language (UML)
(Part 1)
Objectives
By the end of this topic, students will be able to:
Understand the concept and the process of the different modelling using
UML.
Learn and use the different types of diagram of UML.
BSIT 2101 – Object-oriented Programming

Overview
1. Introduction to UML 2.
Types of UML Diagram 3.
UML Case Diagram
BSIT 2101 – Object-oriented Programming

Introduction to
UML
BSIT 2101 – Object-oriented Programming

Unified Modeling Language (UML)


A standardized general-purpose modeling language in the field
of object-oriented software engineering.
A set of graphic notation techniques to create visual models of
object-oriented software systems.
combines techniques from data modeling, business modeling,
object modeling, and component modeling and can be used
throughout the software development life-cycle and across
different implementation technologies

BSIT 2101 – Object-oriented Programming

Unified Modeling Language (UML)


UML is not a programming language, it is rather a visual
language.
The Object Management Group (OMG) adopted Unified
Modelling Language as a standard in 1997.
UML 2.5 is the current revision
BSIT 2101 – Object-oriented Programming

Do we really need UML?


Helps to understand complex system part by part.
Businessmen do not understand code Helps the
team to visualize a system.
BSIT 2101 – Object-oriented Programming

UML Models
UML models contain model elements, such as actors, use cases,
classes, and packages, and one or more diagrams that show a
specific perspective of a system.
The model can be used to do the following
▪ Visually represent a system that you want to build
▪ Communicate your vision of a system to customers and colleagues
▪ Develop and test the architecture of a system
▪ Use the UML diagrams to direct code generation

BSIT 2101 – Object-oriented Programming

UML Diagrams
A UML diagram provides a visual representation of an aspect of
a system.
It illustrate the quantifiable aspects of a system that can be
described visually, such as relationships, behavior, structure, and
functionality.
It provide views of source elements but do not have semantic
value.
It help system architects and developers understand, collaborate
on, and develop an application

BSIT 2101 – Object-oriented Programming

Difference between UML models and


diagrams
graphically.
• Diagrams illustrate the
• Models are abstract quantifiable aspects of a
representations of a system. • system that can be described
Models often contain one or visually
more diagrams that display an • Diagram represents a certain
aspect of a model or a subset of aspect or part of a model.
the model's elements

BSIT 2101 – Object-oriented Programming

Types of
UML Diagram
BSIT 2101 – Object-oriented Programming

Types of UML Diagram


BSIT 2101 – Object-oriented
Programming

Structural Diagrams
Class Diagram
BSIT 2101 –
Object-oriented Programming

Structural Diagrams
Component Diagram
BSIT 2101 – Object-oriented
Programming

Structural Diagrams
Composite Structure Diagram
BSIT 2101 – Object-oriented Programming

Structural Diagrams
Deployment Diagram
BSIT 2101 – Object-oriented Programming

Structural Diagrams
Object Diagram
BSIT 2101 – Object-oriented Programming

Structural Diagrams
Package Diagram
BSIT 2101 – Object-oriented Programming

Structural Diagrams
Profile Diagram
BSIT 2101 – Object-oriented
Programming

Behavior Diagrams
Activity Diagram

BSIT 2101 – Object-oriented Programming

Behavior Diagrams
State Diagram

BSIT 2101 – Object-oriented


Programming

Behavior Diagrams
Use Case Diagram

BSIT 2101 – Object-oriented Programming

Interaction Diagrams
Communication Diagram

BSIT 2101 – Object-oriented Programming

Interaction Diagrams
Interaction Overview Diagram

BSIT 2101 – Object-oriented Programming

Interaction Diagrams
Sequence Diagram

BSIT 2101 – Object-oriented Programming

Interaction Diagrams
Timing Diagram

BSIT 2101 – Object-oriented Programming

UML
Case Diagram
BSIT 2101 – Object-oriented Programming
▪ and the relationships among objects
Class Diagram It gives a high-level view of an
application
A static structure that gives an Name
overview of a software system by
Attributes
displaying
▪ classes
Operations
▪ their attributes,
▪ operations (or methods),
Relationship
BSIT 2101 – Object-oriented Programming

Benefits of Class Diagram


Class Diagram Illustrates data models for even very complex
information systems
It provides an overview of how the application is structured
before studying the actual code. This can easily reduce the
maintenance time
It helps for better understanding of general schematics of an
application.
Allows drawing detailed charts which highlights code required to
be programmed
Helpful for developers and other stakeholders.
BSIT 2101 – Object-oriented Programming

Elements of UML Class Diagram


Class Name
The graphical representation of the class.
It appears in the topmost compartment.
A class is the blueprint of an object which
can share the same relationships,
attributes, operations, & semantics.
The class is rendered as a rectangle,
including its name, attributes, and
operations in sperate compartments.

BSIT 2101 – Object-oriented Programming

Elements of UML Class Diagram


Class Name
Following rules must be taken care of while
representing a class:
▪ A class name should always start with a capital
letter.
▪ A class name should always be in the center of
the first compartment.
▪ A class name should always be written in bold
format.
▪ UML abstract class name should be written in
italics format.

BSIT 2101 – Object-oriented Programming

Elements of UML Class Diagram


Attribute
An attribute is named property of a class
which describes the object being modeled.
It is placed just below the name
compartment.

BSIT 2101 – Object-oriented Programming

Elements of UML Class Diagram


Attribute
The attributes are generally written along
with the visibility factor.
Visibility describes the accessibility of an
attribute of a class.
Attributes must have a meaningful name
that describes the use of it in a class.

BSIT 2101 – Object-oriented Programming

Elements of UML Class Diagram


Relationship
BSIT 2101 – Object-oriented Programming

Class Notation
Class Visibility
The +, - and # symbols before an attribute and operation name
in a class denote the visibility of the attribute and operation. ▪ +
denotes public attributes or operations
▪ - denotes private attributes or operations
▪ # denotes protected attributes or operations

BSIT 2101 – Object-oriented Programming

Class Notation
Parameter Directionality
Each parameter in an operation (method) may be denoted as in,
out or inout which specifies its direction with respect to the
caller. This directionality is shown before the parameter name.

BSIT 2101 – Object-oriented Programming

Perspectives of Class Diagram


A diagram can be interpreted from various perspectives: ▪
Conceptual: represents the concepts in the domain
▪ Specification: focus is on the interfaces of Abstract Data Type (ADTs) in the
software
▪ Implementation: describes how classes will implement their interfaces

BSIT
2101 – Object-oriented Programming

Class Diagram Example


BSIT 2101 – Object-oriented Programming

Class Diagram Example


BSIT 2101 –
Object-oriented Programming
Read the UML Class Diagram

BSIT 2101 – Object-oriented Programming


Read the UML Class Diagram

BSIT
2101 – Object-oriented Programming

Read the UML Class Diagram


BSIT 2101 –
Object-oriented Programming

Read the UML Class Diagram


BSIT
2101 – Object-oriented Programming

Read the UML Class Diagram


BSIT 2101 –
Object-oriented Programming

Tools for UML Diagrams


BSIT 2101 – Object-oriented Programming
BSIT 2101 – Object-oriented Programming

Group Activity 02
Draw a UML diagram based on the scenario provided. Use any UML tools
you want.
Diagram 1. The owner of a small restaurant desires a new information system
to store data for all meals consumed there as well as a record of ingredients
kept on hand. He came up with the following requirements after some
research:
▪ Each ingredient has a name, a measuring unit (e.g. soy sauce is measured in liters,
while tomatoes are unit based) and a quantity in stock. There are no two ingredients
with the same name.
▪ Each dish is composed of several ingredients in a certain quantity. An ingredient can, of
course, be used in different dishes.
▪ A dish has an unique name and a numeric identifier.
▪ There are several tables at the restaurant. Each one of them has an unique numeric
identifier and a maximum amount of people that can be seated there.

BSIT 2101 – Object-oriented Programming

Group Activity 02
▪ In each meal, several dishes are consumed at a certain table. The same dish can be
eaten more than once in the same meal.
▪ A meal takes place in a certain date and has a start and end time. Each meal has a
responsible waiter.
▪ A waiter has an unique numerical identifier, a name, an address and a phone number. ▪
In some cases it is important to store information about the client that consumed the
meal. A client has a tax identification number, a name and an address..

Filename: OOP_Group2_GroupNumber
Deadline: October 31, 2021

BSIT 2101 – Object-oriented Programming

Group Activity 02
Draw a UML diagram based on the scenario provided. Use any UML tools
you want.
Diagram 2. A bicycle renting company wants to create an information system
that allows it to store the data regarding all their reservations and rentals. The
system should follow these requirements:
▪ It should be possible to store the national id number (NIN), tax identification number
(TIN), name and address for every client. The NIN and TIN must be different for every
client and all clients should have at least a TIN and a name.
▪ The database should also contain information about the bicycle models that can be
rented- Each model has an unique name, a type (that can only be road, mountain, bmx
or hybrid) and the number of gears.
▪ Each bicycle has a unique identifying number and a model.

BSIT 2101 – Object-oriented Programming

Group Activity 02
▪ The company has several different stores where bicycles can be picked up and
returned. Each one of these stores is identified by an unique name and has an address
(both mandatory).
▪ When a reservation is made, the following data must be known: which client did the
reservation, when will he pick up the bike (day), which bike model he wants and where
will he pick up the bike (store).
▪ When a bike is picked up, the actual bike that was picked up must be stored in the
database.
▪ When a bike is returned, the return date should be stored in the database.

BSIT 2101 – Object-oriented Programming

Group Activity 02
Draw a UML diagram based on the scenario provided. Use any UML tools
you want.
Diagram 3. An auto repair shop, that sells and mounts parts and accessories
for all kinds of vehicles, wants a new information system to manage their
clients, parts, accessories and assembly services:
▪ There are several employees. Each one of them has an unique identifying number, a
name and an address.
▪ In this shop, assembly services, where parts and accessories are installed in a vehicle,
are executed. For each one these services the following data must be stored: In which
car the service was executed, how many kms had the car at the time, who was the
responsible employee, which parts and accessories were fitted, how many work hours
did it take and the admission and finish dates.
▪ Parts and accessories are only sold together with an assembly service.

BSIT 2101 – Object-oriented Programming

Group Activity 02
▪ Each part/accessory only fits in some car models. Therefore, it is important to store that
information.
▪ Each part/accessory has a category (radio, tire, …), a serial number and a price. ▪ Each
car has a license plate, a make, a model, a color and an owner. Each owner has a name,
identifying number, address and a phone.
▪ One person can own more than one car but one car only has one owner.

BSIT 2101 – Object-oriented Programming

Group Activity 02
Draw a UML diagram based on the scenario provided. Use any UML tools
you want.
Diagram 4. The owner of a veterinary clinic wants to create a database to
store information about all veterinary services performed. After some
research he came up with the following requirements:
▪ For each admitted animal, its name, breed (if any) and owner must be stored. Each
animal should be given an unique numeric identifier.
▪ For each owner, its name, address and phone number should be stored. An unique
numeric identifier should also be generated for each one of them.
▪ An animal might be owner-less. This happens frequently as the clinic often rescues
abandoned dogs from the streets in order to treat them and get them new owners. ▪ It
should be possible to store information about a specific breed even if no animals of that
breed have been treated at the clinic.

BSIT 2101 – Object-oriented Programming

Group Activity 02
▪ Each appointment always has a responsible physician. All appointments start at a
certain date and time; and are attended by an animal (and of course its owner). ▪ For
each physician, his name, address and phone number should be stored. An unique
numeric identifier should also be generated for each one of them. ▪ In an appointment,
several medical conditions might be detected. Each condition has a common name and
a scientific name. No two conditions have the same scientific name.
▪ It should be possible to store information about the most common conditions for each
different breed in the database.

Deadline: November 3, 2021

BSIT 2101 – Object-oriented Programming

</End>

You might also like