DISE - OOAD Using UML

54
Diploma in Software Engineering Module III: OOAD Using UML Rasan Samarasinghe ESOFT Computer Studies (pvt) Ltd. No 68/1, Main Street, Pallegama, Embilipitiya.

Transcript of DISE - OOAD Using UML

Page 1: DISE - OOAD Using UML

Diploma in Software Engineering

Module III: OOAD Using UML

Rasan SamarasingheESOFT Computer Studies (pvt) Ltd.No 68/1, Main Street, Pallegama, Embilipitiya.

Page 2: DISE - OOAD Using UML

Contents1. Object Oriented Programming2. Object and Class3. Object Oriented Programming Concepts4. Unified Modeling Language5. Class Diagrams6. Use Case Diagrams7. Activity Diagrams8. Interaction Diagrams9. Sequence Diagrams10. Collaboration Diagrams11. State Diagrams12. Component Diagrams13. Deployment Diagrams14. UML Software Tools

Page 3: DISE - OOAD Using UML

Object Oriented Programming

• Object-oriented programming (OOP) is a programming language model organized around objects rather than actions and data rather than logic.

• Object oriented programming becoming more popular as a designing technique, because it has an ability to represent complex relationships, data and data processing with suitable notations.

Page 4: DISE - OOAD Using UML

Object Oriented Programming

Male Female

SonFather Mother Daughter

Family system

Objects

Page 5: DISE - OOAD Using UML

Object and Class

An object is person, place or thing which consist of data and behaviors. The data of an object is its properties (attributes) and behavior represent how an object acts and reacts.

A class is simply a representation of a type of object. It is the blueprint / template that describe the details of an object. Class is composed of three things: a name, attributes, and operations.

Page 6: DISE - OOAD Using UML

Object Instance

Object instance is uniquely identified occurrences of an object

Book

Book_idTitleAuthor

LendingReservationReading

Book

001 – ASciencePeter

LendingReservationReading

Object instance

Page 7: DISE - OOAD Using UML

Object Oriented Programming Concepts

Abstraction Inheritance Polymorphism Encapsulation Generalization Specialization

Page 8: DISE - OOAD Using UML

Abstraction

• Abstraction is a mechanism that enables the designer to focus on the essential details of a program component without regard to irrelevant low level details.

• As we move through the design process, the level of abstraction is reduced. Finally, the lowest level of abstraction is reached when source code is generated.

Page 9: DISE - OOAD Using UML

Inheritance

Inheritance is sharing of attributes and operations among classes based on a hierarchical relationship.

Vehiclev-noModelcolorDriveStop

Busv-noModelcolor

DriveStop

Carv-noModelcolor

DriveStop

Super class operations and attributes are inherited to the sub classes

Page 10: DISE - OOAD Using UML

Polymorphism

• Polymorphism is simply the ability for an object behaves differently depending on its type.

• Ex: both cat and dog are animals which has the same method called makeNoise(). But they are making noise in a different way.

Page 11: DISE - OOAD Using UML

Polymorphism

Page 12: DISE - OOAD Using UML

Encapsulation

• According to encapsulation attributes and operations are encapsulated (hidden) within the object.

• The outside world know what the object can do but don’t know how it does or where data is stored. These features are hidden from the user.

Page 13: DISE - OOAD Using UML

Generalization / Specialization

Generalization and specialization both refer to inheritance but the approach in which they are implemented are different.

If many similar existing classes are combined to form a super class to do common job of its subclass, then it is known as Generalization.

If some new subclasses are created from an existing super class to do specific job of the super class, then it is known as Specialization.

Page 14: DISE - OOAD Using UML

Generalization / SpecializationVehicle

v-noModelColorDriveStop

Motorbike

v-noModelcolorDriveStop

Car

v-noModelColorAirbagDriveStopReverse

Specialization

Generalization

Car and Motorbike specialize Vehicle to their own sub-type.

Vehicle Generalize what is common between Car and Motorbike

Page 15: DISE - OOAD Using UML

Unified Modeling Language (UML)

• UML can be described as a general purpose visual modeling language to visualize, specify and document software systems.

• The most important goal for developing UML is to define some general purpose modeling language which all modelers can use and simple to understand and use.

Page 16: DISE - OOAD Using UML

Unified Modeling Language (UML)

1. Class Diagrams2. Use Case Diagrams3. Activity Diagrams4. Interaction Diagrams

1. Sequence Diagrams2. Collaboration Diagrams

5. State Diagrams6. Component Diagrams7. Deployment Diagrams

Page 17: DISE - OOAD Using UML

Class Diagrams

• A class diagram shows the static structure of an object oriented model.

• Also it shows object classed and their internal structures (attributes and operations) and their relationships.

Page 18: DISE - OOAD Using UML

Class Diagrams

Structure of a Class

StudentNameAddressPhone

DisplayAddEditDelete

Class Name

Attributes

Operations

Page 19: DISE - OOAD Using UML

Relationships

• Association• Aggregation• Composition• Generalization

Page 20: DISE - OOAD Using UML

Association

• An association is a relationship among classes or objects.

• Ex: Student follows Course, Lecturer teaches Student, Manager manages company.

manager company

Page 21: DISE - OOAD Using UML

Aggregation

• When an object has an another object, then you have got an aggregation between them.

• Ex: Library has Students

Student Library

Page 22: DISE - OOAD Using UML

Composition

• When an object contains the other object, if the contained object cannot exist without the existence of container object, then it is called composition.

• Ex: University consist from Buildings, Shirt consist from Collar, buttons, etc.

Page 23: DISE - OOAD Using UML

Generalization

Person

Employer Customer

Page 24: DISE - OOAD Using UML

Multiplicity

Multiplicity indicates the number of instance of one class linked to instance of another class.

One to One One to Many

Many to Many

1 1 1 *

* *

Page 25: DISE - OOAD Using UML

Multiplicity

Multiplicity Meaning

1 Only One instance can be linked

* Many instances can be linked

0..* Zero or many instance can be linked

0..1 Zero or one instance can be linked

1..* One or many instance can be linked

5..9 Between 5 and 9 instance can be linked

3,4,5 Only 3,4 or 5 instance can be linked

Page 26: DISE - OOAD Using UML

Class Diagrams

A sample class diagram

Page 27: DISE - OOAD Using UML

Purpose of the class diagrams

Describing the static view of the system.Describing the functionalities performed by

the system.Construction of software applications using

object oriented languages.

Page 28: DISE - OOAD Using UML

Use Case Diagrams

• A use case diagram is a graphical representation of a user's interaction with the system.

• The purpose of use case diagram is to capture the dynamic aspect of a system.

Page 29: DISE - OOAD Using UML

Use Case Diagrams

Page 30: DISE - OOAD Using UML

Use Case Diagrams

Page 31: DISE - OOAD Using UML

Purpose of use case diagrams

Used to gather requirements of a system.Used to get an outside view of a system.Model the context of a system.Understand the project scope.

Page 32: DISE - OOAD Using UML

Activity Diagrams

• Activity diagram is basically a flow chart to represent the flow from one activity to another activity.

• The activity can be described as an operation of the system.

Page 33: DISE - OOAD Using UML

Activity Diagrams

Page 34: DISE - OOAD Using UML

Activity Diagrams

Page 35: DISE - OOAD Using UML

Purpose of activity diagrams

Modeling business requirements.High level understanding of the system's

functionalities.Draw the activity flow of a system.Describe the parallel, branched and

concurrent flow of the system.

Page 36: DISE - OOAD Using UML

Interaction Diagrams

• Interaction diagrams are used to describe some type of interactions among the different elements in the model.

• This interactive behavior is represented in UML by two diagrams known as:1. Sequence diagrams2. Collaboration diagrams

Page 37: DISE - OOAD Using UML

Sequence Diagrams

Sequence diagram emphasizes on time sequence of messages

Page 38: DISE - OOAD Using UML

Sequence Diagrams

Page 39: DISE - OOAD Using UML

Collaboration Diagrams (Communication) Diagrams)

Collaboration diagram emphasizes on the structural organization of the objects that send and receive messages.

Page 40: DISE - OOAD Using UML

Collaboration Diagrams (Communication)

Page 41: DISE - OOAD Using UML

Collaboration Diagrams (Communication)

Page 42: DISE - OOAD Using UML

Purpose of interaction diagrams

To capture dynamic behavior of a system. To describe the message flow in the system. To describe structural organization of the

objects. To describe interaction among objects.

Page 43: DISE - OOAD Using UML

State Diagrams

• State diagrams used to model dynamic nature of a system.

• It describes different states of an object during its lifetime. And these states are changed by events.

Page 44: DISE - OOAD Using UML

State Diagrams

Vacancy Opened Updated Vacancy

Closed

/ Create / Update

[isOpen] / Close

Deleted/ Delete

/ Delete

Page 45: DISE - OOAD Using UML

State Diagrams

Job Seeker Inserted Updated Info

Deleted

/ Create / Update

/ Delete

/ Delete

Page 46: DISE - OOAD Using UML

Purpose of State diagrams

To model dynamic aspect of a system.To identify events responsible for state

changes.To describe different states of an object during

its life time.

Page 47: DISE - OOAD Using UML

Component Diagrams

• Component diagrams are used to model physical aspects of a system.

• These physical aspects are the elements like executables, libraries, files, documents etc which resides in a node.

Page 48: DISE - OOAD Using UML

Component Diagrams

Customer.java Order.java

SpecialOrder.javaNormalOrder.java

Page 49: DISE - OOAD Using UML

Purpose of component diagrams

Visualize the components of a system.Model executables of an application.Model system's source code.Describe the organization and relationships of

the components.

Page 50: DISE - OOAD Using UML

Deployment Diagrams

Deployment diagrams are used to visualize the topology of the physical components (hardware) of a system where the software components are deployed.

Page 51: DISE - OOAD Using UML

Deployment Diagrams

Page 52: DISE - OOAD Using UML

Purpose of Deployment diagrams

To model the hardware topology of a system.Describe runtime processing nodes.Describe the hardware components used to

deploy software components.

Page 53: DISE - OOAD Using UML

UML Software Tools

• Microsoft Office Visio• IBM Rational Rose• Creately

Page 54: DISE - OOAD Using UML

The End

http://twitter.com/rasansmn