object oriented analysis and design using the uml version 4.2
DESCRIPTION
Object Oriented Analysis and Design Using the UML Version 4.2. Prepared by:Kandarp R. Somaiya. Introduction to Object Orientation. Objectives: Introduction to Object Orientation. Understand the basic principles of object orientation - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/1.jpg)
Object Oriented Analysis and Design Using the UML
Version 4.2
Introduction to Object Orientation
Prepared by:Kandarp R. Somaiya
![Page 2: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/2.jpg)
Objectives: Introduction to Object Orientation Understand the basic principles of object
orientation Understand the basic concepts and terms of
object orientation and the associated UML notation
Appreciate the strengths of object orientation Understand some basic UML modeling
mechanisms
![Page 3: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/3.jpg)
Introduction to Object Orientation Topics Basic Principles of Object Orientation Basic Concepts of Object Orientation Strengths of Object Orientation General UML Modeling Mechanisms
![Page 4: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/4.jpg)
Object Orientation
Enca
psul
atio
n
Abst
ract
ion
Hier
arch
y
Mod
ular
ity
Basic Principles of Object Orientation
![Page 5: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/5.jpg)
SalespersonNot saying Which salesperson – just a salesperson in general!!!
Customer Product
Manages Complexity
What is Abstraction?
![Page 6: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/6.jpg)
Improves Resiliency
What is Encapsulation? Hide implementation from clients
Clients depend on interface
How does an object encapsulate?What does it encapsulate?
![Page 7: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/7.jpg)
Order Processing System
Billing
OrderEntry
OrderFulfillment
Manages Complexity
What is Modularity? The breaking up of something complex into
manageable pieces
![Page 8: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/8.jpg)
Decreasing abstraction
Increasing abstraction
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Elements at the same level of the hierarchy should be at the same level of abstraction
What is Hierarchy? Levels of abstraction
![Page 9: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/9.jpg)
Introduction to Object Orientation Topics Basic Principles of Object Orientation Basic Concepts of Object Orientation Strengths of Object Orientation General UML Modeling Mechanisms
![Page 10: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/10.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 11: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/11.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 12: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/12.jpg)
Truck
Chemical Process
Linked List
What is an Object? Informally, an object represents an entity,
either physical, conceptual, or software Physical entity
Conceptual entity
Software entity
![Page 13: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/13.jpg)
A More Formal Definition An object is a concept, abstraction, or thing
with sharp boundaries and meaning for an application
An object is something that has: State Behavior Identity
![Page 14: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/14.jpg)
: Professor
Professor Clark
a + b = 10
ProfessorClark : Professor
ProfessorClark
Class Name Only
Object Name Only
Class and Object Name (stay tuned for classes)
Representing Objects An object is represented as rectangles with
underlined names
![Page 15: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/15.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 16: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/16.jpg)
OO Principle: Abstraction
What is a Class? A class is a description of a group of objects
with common properties (attributes), behavior (operations), relationships, and semantics An object is an instance of a class
A class is an abstraction in that it: Emphasizes relevant characteristics Suppresses other characteristics
![Page 17: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/17.jpg)
a + b = 10
ClassCourse
PropertiesName
LocationDays offeredCredit hours
Start timeEnd time
BehaviorAdd a student
Delete a studentGet course roster
Determine if it is full
Sample Class
![Page 18: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/18.jpg)
Professor
Professor Clark
a + b = 10
Representing Classes A class is represented using a compartmented
rectangle
![Page 19: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/19.jpg)
ProfessornameempID
create( )save( )delete( )change( )
Class Name
Attributes
Operations
Class Compartments A class is comprised of three sections
The first section contains the class name The second section shows the structure
(attributes) The third section shows the behavior (operations)
![Page 20: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/20.jpg)
Classes of Objects How many classes do you see?
![Page 21: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/21.jpg)
Objects Class
Professor Smith
Professor Jones
Professor Mellon
Professor
The Relationship Between Classes and Objects A class is an abstract definition of an object
It defines the structure and behavior of each object in the class
It serves as a template for creating objects Objects are grouped into classes
![Page 22: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/22.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 23: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/23.jpg)
:CourseOfferingnumber = 101startTime = 900endTime = 1100
:CourseOfferingnumber = 104startTime = 1300endTime = 1500
CourseOfferingnumberstartTime endTime
Class
Attribute
Object
Attribute Value
What is an Attribute?
![Page 24: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/24.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 25: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/25.jpg)
CourseOffering
addStudent deleteStudentgetStartTimegetEndTime
Class
Operation
What is an Operation?
![Page 26: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/26.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 27: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/27.jpg)
Manufacturer AManufacturer B
Manufacturer C
OO Principle:Encapsulation
What is Polymorphism? The ability to hide many different
implementations behind a single interface
![Page 28: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/28.jpg)
Tube
Pyramid
Cube
Shape
DrawMoveScaleRotate
<<interface>>
Realization relationship (stay tuned for realization relationships)
What is an Interface? Interfaces formalize polymorphism Interfaces support “plug-and-play”
architectures
![Page 29: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/29.jpg)
Tube
Pyramid
Cube
Shape
DrawMoveScaleRotate
<<interface>>
Tube
Pyramid
CubeShape
Elided/Iconic Representation(“lollipop”)
Canonical (Class/Stereotype) Representation
(stay tuned for realization relationships)
Interface Representations
![Page 30: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/30.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 31: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/31.jpg)
Source FileName
<<EXE>>ExecutableName
OO Principle:Encapsulation
What is a Component? A non-trivial, nearly independent, and
replaceable part of a system that fulfills a clear function in the context of a well-defined architecture
A component may be A source code component A run time components or An executable component
<<DLL>>ComponentNameComponent
Interface
![Page 32: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/32.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 33: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/33.jpg)
Package NameOO Principle:
Modularity
What is a Package? A package is a general purpose mechanism
for organizing elements into groups A model element which can contain other
model elements
Uses Organize the model under development A unit of configuration management
![Page 34: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/34.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 35: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/35.jpg)
OO Principles: Encapsulation and Modularity
<<subsystem>>Subsystem Name
InterfaceInterface
RealizationSubsystem
(stay tuned for realization relationship)
What is a Subsystem? A combination of a package (can contain other
model elements) and a class (has behavior) Realizes one or more interfaces which define
its behavior
![Page 36: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/36.jpg)
ComponentName
Design Model Implementation Model
<<subsystem>>Component Name
Component Interface
Component Interface
OO Principles: Encapsulation and Modularity
Subsystems and Components Components are the physical realization of an
abstraction in the design Subsystems can be used to represent the
component in the design
![Page 37: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/37.jpg)
Basic Concepts of Object Orientation Object Class Attribute Operation Interface (Polymorphism) Component Package Subsystem Relationships
![Page 38: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/38.jpg)
Relationships Association
Aggregation Composition
Dependency Generalization Realization
![Page 39: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/39.jpg)
Professor UniversityWorks for
Class
Association
Association Name
Professor UniversityEmployerEmployee
Role Names
Relationships: Association Models a semantic connection among classes
![Page 40: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/40.jpg)
Student Schedule
Whole
Aggregation
Part
Relationships: Aggregation A special form of association that models a
whole-part relationship between an aggregate (the whole) and its parts
![Page 41: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/41.jpg)
Student Schedule
Whole
Aggregation
Part
Relationships: Composition A form of aggregation with strong ownership
and coincident lifetimes The parts cannot survive the whole/aggregate
![Page 42: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/42.jpg)
Association: Multiplicity and Navigation Multiplicity defines how many objects
participate in a relationships The number of instances of one class related to
ONE instance of the other class Specified for each end of the association
Associations and aggregations are bi-directional by default, but it is often desirable to restrict navigation to one direction If navigation is restricted, an arrowhead is added
to indicate the direction of the navigation
![Page 43: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/43.jpg)
Association: Multiplicity Unspecified Exactly one Zero or more (many, unlimited)
One or more Zero or one Specified range Multiple, disjoint ranges
2..4
0..1
1..*
0..*
1
*
2, 4..6
![Page 44: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/44.jpg)
Student Schedule1 0..*
Multiplicity
Navigation
Example: Multiplicity and Navigation
![Page 45: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/45.jpg)
Client Supplier
Package
ClientPackage SupplierPackage
Client Supplier
Class
Dependency relationship
Dependency relationship
Component
Relationships: Dependency A relationship between two model elements
where a change in one may cause a change in the other
Non-structural, “using” relationship
![Page 46: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/46.jpg)
Relationships: Generalization A relationship among classes where one class
shares the structure and/or behavior of one or more classes
Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses Single inheritance Multiple inheritance
Generalization is an “is-a-kind of” relationship
![Page 47: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/47.jpg)
Accountbalancenamenumber
Withdraw()CreateStatement()
Checking
Withdraw()
Savings
GetInterest()Withdraw()
Superclass (parent)
Subclasses
Generalization Relationship
Ancestor
Descendents
Example: Single Inheritance One class inherits from another
![Page 48: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/48.jpg)
Airplane Helicopter Wolf Horse
FlyingThing Animal
Bird
multipleinheritance
Use multiple inheritance only when needed, and always with caution !
Example: Multiple Inheritance A class can inherit from several other classes
![Page 49: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/49.jpg)
Inheritance leverages the similarities among classes
What Gets Inherited? A subclass inherits its parent’s attributes,
operations, and relationships A subclass may:
Add additional attributes, operations, relationships Redefine inherited operations (use caution!)
Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy
![Page 50: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/50.jpg)
Truck
tonnage
GroundVehicle
weightlicenseNumber
Car
owner
register( )
getTax( )
Person
0..*
Trailer
1Superclass
(parent)
Subclass
generalization
size
Example: What Gets Inherited
![Page 51: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/51.jpg)
Component
Interface
Use Case Use-Case Realization
Elided form
Class
InterfaceSubsystem
Interface
Canonical form
Relationships: Realization One classifier serves as the contract that the
other classifier agrees to carry out Found between:
Interfaces and the classifiers that realize them
Use cases and the collaborations that realize them
![Page 52: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/52.jpg)
Class Diagram for the Sales Example
Salesperson Product
Sale
Corporate
Customer
Individual Truck
Vehicle
Train
seller buyer item sold shipping mechanism
![Page 53: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/53.jpg)
Effect of Requirements ChangeSuppose you need a new type of shipping vehicle ...
Salesperson Product
Sale
Corporate
Customer
Individual Truck
Vehicle
Train
seller buyer item sold shipping mechanism
Change involves adding a new subclass
Airplane
![Page 54: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/54.jpg)
Introduction to Object Orientation Topics Basic Principles of Object Orientation Basic Concepts of Object Orientation Strengths of Object Orientation General UML Modeling Mechanisms
![Page 55: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/55.jpg)
<<boundary>>MyBoundaryClass
MyBoundaryClass
Stereotypes Classify and extend the UML notational
elements Define a new model element in terms of
another model element May be applied to all modeling elements Represented with name in guillemets or as a
different icon
![Page 56: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/56.jpg)
<<boundary>>
<<boundary>>
<<trace>>
Processor #1<<Processor>>
DesignClass
Processor #1
Example: Stereotypes
Sample boundary class (stereotype)Stereotype of ‘dependency relation’Stereotype of <<Processor>>
These create new symbols using accustomed graphics.
![Page 57: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/57.jpg)
There can be up to one MaintainScheduleForm per user session.MaintainScheduleForm
Notes A note can be added to any UML element Notes may be added to add more information
to the diagram It is a ‘dog eared’ rectangle The note may be anchored to an element with
a dashed line
![Page 58: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/58.jpg)
PersistentClass{persistence} anObject : ClassA
{location=server}
Tagged Values Extensions of the properties, or specific
attributes, of a UML element Some properties are defined by UML
Persistence Location (e.g., client, server)
Properties can be created by UML modelers for any purpose
![Page 59: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/59.jpg)
Professor DepartmentMember
Department Head{subset}
1..*
1
1
1
Constraints Supports the addition of new rules or
modification of existing rules
This notation is used to capture two relationships between Professor-type objects and Department-type objects; where one relationship is a subset of another….
Shows how UML can be tailored to correctly modeling exact relationships….
![Page 60: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/60.jpg)
(continued)
Review: Introduction to Object Orientation What are the four basic principles of object
orientation? Provide a brief description of each.
What is an Object and what is a Class? What is the difference between them?
What is an Attribute? What is an Operation? What is an Interface? What is Polymorphism? What is a Component?
![Page 61: Object Oriented Analysis and Design Using the UML Version 4.2](https://reader036.vdocument.in/reader036/viewer/2022070423/56816784550346895ddc9560/html5/thumbnails/61.jpg)
Review: Introduction to Object Orientation (cont.) What is a Package? What is Subsystem? How does it relate to a
Component? How does it relate to a package? How does it relate to a class?
Name the 4 basic UML relationships and describe each.
Describe the strengths of object orientation. Name and describe some general UML
mechanisms. What are stereotypes? Name some common
uses of stereotypes.