dise - ooad using uml
TRANSCRIPT
Diploma in Software Engineering
Module III: OOAD Using UML
Rasan SamarasingheESOFT Computer Studies (pvt) Ltd.No 68/1, Main Street, Pallegama, Embilipitiya.
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
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.
Object Oriented Programming
Male Female
SonFather Mother Daughter
Family system
Objects
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.
Object Instance
Object instance is uniquely identified occurrences of an object
Book
Book_idTitleAuthor
LendingReservationReading
Book
001 – ASciencePeter
LendingReservationReading
Object instance
Object Oriented Programming Concepts
Abstraction Inheritance Polymorphism Encapsulation Generalization Specialization
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.
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
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.
Polymorphism
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.
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.
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
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.
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
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.
Class Diagrams
Structure of a Class
StudentNameAddressPhone
DisplayAddEditDelete
Class Name
Attributes
Operations
Relationships
• Association• Aggregation• Composition• Generalization
Association
• An association is a relationship among classes or objects.
• Ex: Student follows Course, Lecturer teaches Student, Manager manages company.
manager company
Aggregation
• When an object has an another object, then you have got an aggregation between them.
• Ex: Library has Students
Student Library
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.
Generalization
Person
Employer Customer
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 *
* *
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
Class Diagrams
A sample class diagram
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.
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.
Use Case Diagrams
Use Case Diagrams
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.
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.
Activity Diagrams
Activity Diagrams
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.
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
Sequence Diagrams
Sequence diagram emphasizes on time sequence of messages
Sequence Diagrams
Collaboration Diagrams (Communication) Diagrams)
Collaboration diagram emphasizes on the structural organization of the objects that send and receive messages.
Collaboration Diagrams (Communication)
Collaboration Diagrams (Communication)
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.
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.
State Diagrams
Vacancy Opened Updated Vacancy
Closed
/ Create / Update
[isOpen] / Close
Deleted/ Delete
/ Delete
State Diagrams
Job Seeker Inserted Updated Info
Deleted
/ Create / Update
/ Delete
/ Delete
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.
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.
Component Diagrams
Customer.java Order.java
SpecialOrder.javaNormalOrder.java
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.
Deployment Diagrams
Deployment diagrams are used to visualize the topology of the physical components (hardware) of a system where the software components are deployed.
Deployment Diagrams
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.
UML Software Tools
• Microsoft Office Visio• IBM Rational Rose• Creately
The End
http://twitter.com/rasansmn