You are on page 1of 42

OBJECT ORIENTED

MODELING, CONCEPTS
AND PRINCIPLES
• What is object-oriented development ?
• Object-oriented process model
• Object-oriented concepts
• Object modeling technique
• Unified Modeling Language (UML)
• Concepts and Principles of Object Modeling
• Object-oriented vs functional approach

CONTENTS
What is OO Development ?
• “New” way of thinking about problems using
models organized around real world concepts.
• The fundamental construct is the object
o Combines both data structure and operations in a
single entity called an object.
• Leads to reuse, faster software development
and higher quality programs.
• Easier to maintain
o Structure inherently decoupled
o Fewer side-effects
The OO process model
• Moves through an evolutionary spiral
• Emphasizes development of reuse capability
Object Oriented Concepts
• Objects and Object Model
o Object: Data and operations relevant to some real
world or significant program entity encapsulated
into a monolithic unit accessible only through a
well defined interface. For ex. File in the file
system together with operations such as open,
close, read, & write,
o Object Model: Describes the structure of the
objects in the system
 their identity, relationships to other objects, attributes
and operations.
Object Modeling
• Classification & Classes
o A class describes a group of objects with similar
properties (attributes), common behavior
(operations), common relationships to other
objects, and common semantics.
• Thus, a class is an abstraction that describes
relevant properties and hides the rest.
Represented diagrammatically as below.

Class Name
Attributes
Operations
Object Classes
Object Modeling
Object Modeling
• Attributes: An attribute is a data value held by
the objects in a class. Name, age, and weight
are attributes of Person objects.
Object Modeling
• Operations and Methods :
o Operations : An operation is a function or
transformation that may be applied to or by objects
in a class. Each operation has a target object as an
implicit argument. The behavior of the operation
depends on the class of its target.
o Methods : A method is the implementation of an
operation for a class.
 Categories: 1) manipulate data, 2) perform computation,
and 3) monitor for occurrence of controlling event.
Object Modeling
• An operation may have arguments in addition
to its target object. Such arguments
parameterize the operation but do not affect
the choice of method.
Class and Instance

Polygon Polygon
Vertices v={(0,0),(0,1),(1,0)}
Border Color BC = Red
Fill Color FC = Blue
Draw Draw
Erase Erase
Move Move
Abstraction and Encapsulation
Abstraction and Encapsulation

• Abstraction
o Isolate those aspects that are important and
suppress (or hide) those that are unimportant
(e.g., representations).
o Focus on what object is and does before deciding
how it should be implemented.
o Abstraction allows dealing only with application
domain concepts, not making design and
implementation decision before problem is
understood.
Abstraction and Encapsulation

• Encapsulation (Information Hiding)


o Separates the external aspects of an object, which
are accessible to other objects, from the internal
implementation details of the object, which are
hidden from other objects.
• Combining Data and Operations:
o The OO approach combines the data structure
and operations in a single entity.
Interfaces

<<Interface>>
Class Name
Operations

• Does not have an implementation of its own.


• Other classes provide implementations of it.
• Client classes are only interested in behavior.
Inheritance
• Sharing of attributes and operations among classes
based on hierarchical relationship.
Polygon Right Triangle
Vertices
Vertices Hypotenuse length
Border Color Border Color
Fill Color Fill Color
Draw Draw
Erase Erase
Move Move

Class and Subclass

• Polymorphism
o The same “operation” may behave differently on
different classes. E.g., the move operation behaves
differently on a Window and ChessPiece.
o Operations may be overloaded when subclasses
defined.
 The compiler can distinguish based on the type of the
operands in method invocations which operation is
actually needed.

Operations
Polymorphism

Polygon Car
Paint Paint

Triangle Square
Paint Paint
Communication
• Message: [destination, operation, params]
What Does OO Mean?
• Pressman (Coad & Yourdon)
o Objects (identity)
o Classification
o Inheritance
o Communication
• Rumbaugh
o Objects (identity)
o Classification
o Inheritance
o Polymorphism
• Object modeling technique (OMT) extends from
analysis thru design to implementation
• Analysis model contains objects found in the
application domain, including properties of object
and their operations.
• These application domain objects form a
framework to the design model.

Object Modeling Technique


Object Modeling Technique
• The same seamless notation is used from
analysis to design to implementation.
• The system is modeled using three related but
different view points.
o Object Model : Represents the static, structural,
“data” aspects of the system.
o Dynamic Model : Represents the temporal,
behavioral, “control” aspects of the system.
o Functional Model : Represents transformational,
“functional” aspects of the system.
Object Modeling
• Links and Associations
o Link: A physical or conceptual connection between
instances. E.g., Joe Smith Works-for Simplex company.
Mathematically, a tuple, i.e., an ordered list of object
instances. A link is an instance of an association.
o Associations : A group of links with common structure
and semantics. E.g., a person Worksfor a company. All
the links in an association connect objects from the
same classes.
Object Modeling
• Multiplicity:
o Specifies how many instances of one class may
relate to a single instance of an associated class
• Role Names:
o One end of an association. Binary association has
two roles.
• Link attributes
o May be defined for associations, e.g., if the
association is “uses,” the link attribute might be
one of permission.
Binary Association & Multiplicity
Ternary Association
Link Associations
Aggregation
• A “part-whole” or “a-part-of” relationship
OO Software Process
• Framework
o Identify major classes and connections.
o Do enough design to ensure they are implementable
o Extract reusable components and build prototype.
o Test to uncover errors and get customer feedback.
o Iterate on design and refine it.
o Engineer special objects (not in library).
o Assemble a new prototype.
o Test and obtain customer feedback.
o Iterate until satisfactory product obtained.
OO Metrics
• Because of reuse, LOC not so useful
• # of Scenario scripts, each a triplet of the form
[initiator, action, participant], where
• Initiator = object initiating a request
• action = result of request (method invocation)
• participant = server object satisfying request
• # of key [highly independent] classes
• # of support classes (and ave. per key class)
• # of subsystems
• Develop scenario scripts and estimate count
Possible
• DetermineEstimating
the number ofApproach
key classes
• Categorize key classes
Interface type Multiplier
No GUI 2.0
Text-based user int. 2.25
GUI 2.5
Complex GUI 3.0
• Estimate # of support classes by multiplying #
key classes in each category by multiplier
• Estimate # of person-days per class, e.g., 15-20
• Estimate the number of major iterations
• There should be a contract deliverable for each
major iteration

Possible Estimating Approach


• This needs to be done for each iteration (see
text for list of specifics in each category)
o OO analysis completed
o OO design completed
o OO programming completed
o OO testing completed

OO Progress Tracking
• Easier to maintain • Harder to maintain
• Combines data • May separate data and
structure and behavior behavior
in a single entity • Emphasizes
• Emphasizes object procedural structure
structure • Reuse limited, hence
• Reuse more readily possible delay in
accomplished software construction

Object-Oriented vs Structured Approach


• Strong cohesion and • Harder to achieve
weak coupling weak Coupling and
• Encapsulation, strong cohesion
Inheritance and • Some languages
Polymorphism are support encapsulation
strong features of OO and polymorphism, but
software development rarely inheritance

Object-Oriented vs Structured Approach

You might also like