Object-Oriented Programming (BSIT-2101) : Junar A. Landicho
Object-Oriented Programming (BSIT-2101) : Junar A. Landicho
(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
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
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
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
Behavior Diagrams
State Diagram
Behavior Diagrams
Use Case Diagram
Interaction Diagrams
Communication Diagram
Interaction Diagrams
Interaction Overview Diagram
Interaction Diagrams
Sequence Diagram
Interaction Diagrams
Timing Diagram
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
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
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
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.
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
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.
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.
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.
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.
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.
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.
</End>