Object Oriented Analysis and Design 1 Introduction to Object Modeling Object-oriented analysis (OOA) – an approach used to 1. study existing objects to see if they can be reused or adapted for new uses 2. define new or modified objects that will be combined with existing objects into a useful business computing application Object modeling – a technique for identifying objects within the systems environment and the relationships between those objects.
61
Embed
Object Oriented Analysis and Design1 Introduction to Object Modeling Object-oriented analysis (OOA) – an approach used to 1.study existing objects to see.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Object Oriented Analysis and Design 1
Introduction to Object Modeling
Object-oriented analysis (OOA) – an approach used to 1. study existing objects to see if they can be reused or
adapted for new uses
2. define new or modified objects that will be combined with existing objects into a useful business computing application
Object modeling – a technique for identifying objects within the systems environment and the relationships between those objects.
Object Oriented Analysis and Design 2
Introduction to the UML
Unified Modeling Language (UML) – a set of modeling conventions that is used to specify or describe a software system in terms of objects.– The UML does not prescribe a method
for developing systems—only a notation that is now widely accepted as a standard for object modeling.
Object Oriented Analysis and Design 3
Analysis and Design
• Analysis– Captures requirements
and problem domain
– What to do
– Creates analysis models• Use case view• Static class view
• Design– Makes strategic and
tactical decisions to meet requirements
– How to do it (above code level)
– Creates design models• Static class view• State machine view• Interaction view
Object Oriented Analysis and Design 4
Meyer
Before and after conditions
Harel
StatechartsGamma, et al
Frameworks and patterns,
HP Fusion
Operation descriptions and message numbering
Embley
Singleton classes andhigh-level view
Wirfs-Brock
Responsibilities
Odell
Classification
Shlaer - Mellor
Object lifecycles
Rumbaugh
OMT
Booch
Booch method
Jacobson
OOSE
Contributions to the UML
Object Oriented Analysis and Design 5
Object Orientation
Enca
psul
atio
n
Abs
trac
tion
Hie
rarc
hy
Mod
ular
ity
Basic Principles of Object Orientation
Object Oriented Analysis and Design 6
Salesperson
Not saying Which salesperson – just a salesperson in general!!!
CustomerProduct
Manages Complexity
What is Abstraction?
Object Oriented Analysis and Design 7
Improves Resiliency
What is Encapsulation?
• Hide implementation from clients– Clients depend on interface
How does an object encapsulate?What does it encapsulate?
Object Oriented Analysis and Design 8
Order Processing System
Billing
OrderEntry
OrderFulfillment
Manages Complexity
What is Modularity?
• The breaking up of something complex into manageable pieces
Object Oriented Analysis and Design 9
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
Object Oriented Analysis and Design 10
Objects, Attributes, & Instances
Object – something that is or is capable of being seen, touched, or otherwise sensed, and about which users store data and associate behavior.– Person, place, thing, or event– Employee, customer, instructor, student– Warehouse, office, building, room– Product, vehicle, computer, videotape
Attribute – the data that represent characteristics of interest about an object.
Object instance – each specific person, place, thing, or event, as well as the values for the attributes of that object.
Object Oriented Analysis and Design 11
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
Object Oriented Analysis and Design 12
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
Object Oriented Analysis and Design 13
: Professor
Professor Clark
a + b = 10
ProfessorClark : Professor
ProfessorClark
Class Name OnlyObject Name Only
Class and Object Name
Representing Objects
• An object is represented as rectangles with underlined names
Object Oriented Analysis and Design 14
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
Object Oriented Analysis and Design 15
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
Object Oriented Analysis and Design 16
Professor
Professor Clark
a + b = 10
Representing Classes
• A class is represented using a compartmented rectangle
Object Oriented Analysis and Design 17
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)
Object Oriented Analysis and Design 18
VTOLJet Drone
GliderMilitary Space Shuttle
Helicopter Turboprop Airship
Exercise: How many classes could you find here?
Object Oriented Analysis and Design 19
:CourseOffering
number = 101startTime = 900endTime = 1100
:CourseOffering
number = 104startTime = 1300endTime = 1500
CourseOffering
numberstartTime endTime
Class
Attribute
Object
Attribute Value
What is an Attribute?
Object Oriented Analysis and Design 20
CourseOffering
addStudent deleteStudentgetStartTimegetEndTime
Class
Operation
What is an Operation?
Object Oriented Analysis and Design 21
Manufacturer AManufacturer B Manufacturer C
OO Principle:Encapsulation
What is Polymorphism?
• The ability to hide many different implementations behind a single interface
Object Oriented Analysis and Design 22
Tube
Pyramid
Cube
Shape
DrawMoveScaleRotate
<<interface>>
What is an Interface?
• Interfaces formalize polymorphism
• Interfaces support “plug-and-play” architectures
Object Oriented Analysis and Design 23
Inheritance (cont.)
Object Oriented Analysis and Design 24
Generalization/Specialization, Supertype, and Subtype
Generalization/specialization – a technique wherein the attributes and behaviors that are common to several types of object classes are grouped (or abstracted) into their own class, called a supertype. The attributes and methods of the supertype object class are then inherited by those object classes.
Supertype – an entity that contains attributes and behaviors that are common to one or more class subtypes.
– Also referred to as abstract or parent class.
Subtype – an object class that inherits attributes and behaviors from a supertype class and then may contain other attributes and behaviors that are unique to it.
– Also referred to as a child class and, if it exists at the lowest level of the inheritance hierarchy, as concrete class.
Object Oriented Analysis and Design 25
UML Representation of Generalization/Specialization
Object Oriented Analysis and Design 26
VTOLJet Drone
GliderMilitary Space Shuttle
Helicopter Turboprop Airship
Exercise: Refine the number of classes here?
Object Oriented Analysis and Design 27
Inheritance Relationship
• A class can Inherit the instance variables, interfaces, and instance methods of another class.
• The class inherit them as if they were defined in the class.– A class providing the inheritance is a base class– The class getting the inheritance is a derived class
• A derived class can override/extend the base class– The base class methods can be redefined– The base class can define new variables and methods
• A derived class can be used anyplace a base class can be used.– The derived class ISA a base class.
Object Oriented Analysis and Design 28
Multiple Inheritance Relationship
• A derived class can inherit from multiple base classes– It will contain all the variables and methods of every
base class.– The derived class ISA base class for every base class
inherited• This class can be used any place any of the original base
classes could be used.
Object Oriented Analysis and Design 29
Object/Class Relationships
Object/class relationship – a natural business association that exists between one or more objects and classes.
Object Oriented Analysis and Design 30
Multiplicity and UML Multiplicity Notations
Multiplicity – the minimum and maximum number of occurrences of one object/class for a single occurrence of the related object/class.
Object Oriented Analysis and Design 31
AggregationAggregation – a relationship in which one larger “whole” class contains one or more smaller “parts” classes. Conversely, a smaller “part” class is part of a “whole” larger class.
Object Oriented Analysis and Design 32
Composition
Composition – an aggregation relationship in which the “whole” is responsible for the creation and destruction of its “parts.” If the “whole” were to die, the “part” would die with it.
Object Oriented Analysis and Design 33
Contains Relationship
• A class can contain another class.• The class contains another class by having an Instance
Variable of the class in it’s specification• The composition of classes into a single class allow a simpler
abstraction to be defined for a highly complex group of classes.
Message – communication that occurs when one object invokes another object’s method (behavior) to request information or some action
Object Oriented Analysis and Design 35
Polymorphism
• Polymorphism means “Many Form”
• Two objects are polymorphic if they have the same interface and different behavior.
• This allows clients to use them without knowing their true behavior.
Object Oriented Analysis and Design 36
Polymorphism
Polymorphism – literally meaning “many forms,” the concept that different objects can respond to the same message in different ways.
Override – a technique whereby a subclass (subtype) uses an attribute or behavior of its own instead of an attribute or behavior inherited from the class (supertype).
Object Oriented Analysis and Design 37
Professor UniversityWorks for
Class
Association
Association Name
Professor University
EmployerEmployee
Role Names
Relationships: Association
• Models a semantic connection among classes
Object Oriented Analysis and Design 38
Uses Relationship
• A class uses another class without containing it.• The class gets access to the object when it’s
passed to a class interface as an argument.• Example:HomeStereoSystem::Play(CD&)
• The play interface of HomeStereoSystem takes a Compact Disc (CD) object which it can use.
Object Oriented Analysis and Design 39
Abstract Classes
• Used to hold common operations and data• Used in inheritance hierarchy
– Derived (child) classes provide implementations
• Documented with class name in italics– Can also use {abstract} property