MS - Sem1 - OO Analysis and Design - post 1
OO principles (The four
fundamentals)
–Abstraction (a simplified description)
“An abstraction denotes the
essential characteristics of an object that distinguish it from all other kind
of objects and thus provide crisply defined conceptual boundaries, relative to
the perspective of the viewer”
–Encapsulation
In
general, encapsulation is one of the four fundamentals of OOP (object-oriented
programming). Encapsulation is to hide the variables or something inside a
class, preventing unauthorized parties to use. So the public methods like
getter and setter access it and the other classes call these methods for
accessing.
•Information hiding •Interface
–Implementation •Behavior
& Data
In his book on object-oriented design, Grady Booch
defined encapsulation as "the process of compartmentalizing the elements
of an abstraction that constitute its structure and behavior; encapsulation
serves to separate the contractual interface of an abstraction and its
implementation."
–Hierarchy
“Hierarchy is a ranking of abstractions”
Inheritance: expresses “is-a” or “Kind-of”
relationship (Extensibility & Reusability)
Part-of:
expresses
that object is an aggregate of
another
–Polymorphism
Hiding alternative procedures behind a
Common Interface
Send a Message to an object
-Polymorphism guarantees that the correct/proper implementations invoked.
Sender does not know specific class of
receiver
v Benefits of OO Paradigm
• Models System using Objects
• Understanding the system is easier
• No change to your existing code (almost) –If designed
properly, of course!
• Extensibility
v Object –
§ “Concept, abstraction, or thing with crisp boundary &
meaning for a problem”
§ An Object has state and behavior
§ Objects receive stimuli/messages & respond
§ Receiving a stimulus, Object may change state
§ Class is blueprint
of objects.
§ Each object knows its class.
v Structured Programming
§ Look at the problem
§ Design a collection of functions
o –Break down the
functions into smaller pieces; Functional Decomposition
§ Identify the characteristics or data
o –Define them globally
§ Map the functions with the required data
Ripple
effect:
Upon
introducing a local change in a method or a class in an object oriented
program, the ripple effect gives a
measure of the amount by which this change may affect other methods/classes.
That is, the ripple effect shows
maintainers the ramifications of any change they may make before that change is
actually implemented. We need to propose techniques for measuring the ripple
effect in object oriented programs and use it to compute an indicator of
logical stability. First, we investigate object oriented dependences and
illustrate how these dependences and some metrics can be used to determine
change impact and propagation. Then, we use matrix arithmetic techniques for
computing the ripple effect in object oriented programs and show their
application at the intra-class, inter-class and architectural levels.
v Structured Programming: Issues
§ System becomes too complex
§ Data and functions are scattered throughout
§ Accommodate change in requirements is a pain
§ Maintenance and debugging is an issue
v Object Oriented Programming
§ Lessens the impact of the problem
§ Combines data and functions into the same module
§ Modules can talk to each other directly
§ Small gap between reality and model
§ Modifications are localized
o Confined to a module
§ Module is the Object
The
key difference between Structured
Programming and OOP is that the focus of Structured Programming is to
structure the program in to a hierarchy of subprograms while, the focus of OOP
is to break down the programming task in to objects, which encapsulate data and
methods. OOP is considered more flexible than structured programming, because
OOP separates a program in to a network of subsystems rather than structuring
the program in to a hierarchy. Even though structuring provides certain
clarity, a small change to a very large structured program may cause a ripple
effect of having to change multiple subprograms.
v Object -Oriented Development
§ Functions and data highly integrated
§ More understandable
§ More flexible to modifications
§ Stable -modifications are localized
v Object -Oriented Analysis
§ Activities:
o –Finding the objects
o –Organizing the objects
o –Describing object interaction
o –Defining operations on the objects
o –Defining the object’s internals
§ Obtain understanding of system based on functional
requirements
§ Considers functional requirements & data as integrated
objects
v OO Design & Implementation
§ Analysis model Designed & Implemented
§ Take care of restrictive demands
o Memory, response time, etc.
§ Traceability of Objects
§ Create & use Components
v OOA vs OOD
§ OOA is the act of determining the abstractions which underlay
the requirements. It is the backwards reasoning that starts with the requirements
and ends up with a set of objects that express the abstractions; and messages that
support the required behaviors.
§ OOD embodies the set of decisions that determines how those
objects and methods will be implemented. Typically class inheritance and composition
hierarchies are among those design decisions
v OOA/OOD
Analysis and Design should not
be separated into broad phases. Nor should the analysis model be frozen before the
design modeling begins. The analysis model cannot be completed in the absence of
the design model. And the design model cannot be completed in the absence of the
analysis model. -RobertMartin
Comments