2. What is Object-Orientation?
- Object
An "object" is anything to which a concept applies.
A "concept" is an idea or notion that we apply to the things, or objects,
in our awareness
Thing drawn from the problem domain or solution space.
E.g., a living person in the problem domain, a software component in the
solution space.
A structure that
- has identity (i.e., discrete and distinguishable), and
- bundles together attributes (the data part, or state) and
behavior (the function/code part).
It is an instance of a collective concept, i.e., a class.
12/01/12 Amandeep S. Patti 2
3. Properties of an object
Attribute: A characteristic of an object that has
value in the context of the system
Method: How an object allows other objects to
interact with it
Method overloading: When a method name is used for
different reasons in the same scope, the method is
overloaded
State: a condition during the life of an object
12/01/12 Amandeep S. Patti 3
4. What is Object-Orientation?
- Class
A collection of objects with the same data structure
(attributes, state variables) and behavior
(function/code/operations) in the solution space.
A blueprint or definition of objects.
Classification
Grouping of common objects into a class
Instance
An object created by a class.
Instantiation
The act of creating an instance.
12/01/12 Amandeep S. Patti 4
5. Describing a class
Why does a class exist?
What is it relevance to others?
What are the attributes?
What are its methods?
12/01/12 Amandeep S. Patti 5
6. Fundamentals of Object Orientation
Data Abstraction and Encapsulation
Inheritance
Polymorphism
12/01/12 Amandeep S. Patti 6
7. Data Abstraction and Encapsulation
Data Abstraction is defined as extracting from the
abundance of information-related data. It is
important that related data be kept together for
easier manipulation. It is equally important to
abstract the generic data from specific details.
Encapsulation is defined as hiding related data
behind an interface of methods. These methods
allow access to the data and manipulations to be
performed on the data.
12/01/12 Amandeep S. Patti 7
8. Data Abstraction and Encapsulation
Attributes
Set data values Get data values
Attributes
Manipulate data values
12/01/12 Amandeep S. Patti 8
9. Abstraction
Focus on the essential.
Focus on what an object “is and does”.
Omits tremendous amount of details.
Must always be for some purpose, because
purpose determines what is and what is not
important.
Many abstractions of the same thing are possible.
All abstractions are incomplete and inaccurate.
A good model captures the crucial aspects of a
problem and omits the others.
12/01/12 Amandeep S. Patti 9
10. Example of Abstraction
Class
Car
Attributes
Model
Location
Operations
Start
Accelerate
12/01/12 Amandeep S. Patti 10
11. Inheritance
Inheritance brings properties that are
common across several classes into one
general class. This class then becomes
the parent class to more specific class or
child class.
Two types.
Derived inheritance.
Abstracted inheritance.
12/01/12 Amandeep S. Patti 11
12. Polymorphism
There are two possible definitions for the
term polymorphism
Different classes supporting the same method
(overriding)
An object supports multiple interface.
12/01/12 Amandeep S. Patti 12
13. Overriding
The mechanism by which a child class can
provide an alternative implementation of a
method currently provided by a parent
class.
12/01/12 Amandeep S. Patti 13
14. What Is Object Oriented Development?
It’s a new way of thinking about software
based on abstractions that exist in the real
world.
The essence of object-oriented
development is the identification and
organization of application-domain
concepts, rather than their final
representation in a programming language.
12/01/12 Amandeep S. Patti 14
15. What Is Object Oriented Development?
It is only when the inherent concepts of the
application are identified, organized and
understood that the details of data
structures and functions can be addressed
effectively.
12/01/12 Amandeep S. Patti 15
16. How It Is Different From Functional
Methodology?
In functional methodology, emphasis on
specifying and decomposing system
functionality. If requirements changes, the
system may require massive changes.
Object oriented approach focuses first on
identifying objects from the application
domain, then fitting procedures around
them.
12/01/12 Amandeep S. Patti 16
17. What Is OOAD?
Analysis — understanding, finding and
describing concepts in the problem domain.
Design — understanding and defining software
solution/objects that represent the analysis
concepts and will eventually be implemented in
code.
OOAD —A software development approach
that emphasizes a logical solution based on
objects.
12/01/12 Amandeep S. Patti 17
18. What Is OOAD?
Object-orientation
Allows users to fully understand the environment they
are attempting to model
OOAD is an OO methodology for analyzing and
designing a system. It is not necessarily relevant
to any programming language, even it may be
irrelevant to any programming task. It is the
recognition methodology to understand the world.
In this sense OOP is the application of OOAD to
software programming tasks
12/01/12 Amandeep S. Patti 18
19. What Is OOAD?
The fundamental construct is the object,
which combines both data structure and
behaviour in a single entity.
Object oriented models are useful for
understanding problems, communicating
with application experts, modeling
enterprises, preparing documents and
designing programs and databases .
12/01/12 Amandeep S. Patti 19
20. What Is a Model?
A model is a simplification of reality.
E.g., a miniature bridge for a real bridge to be built
A model is our simplification of our
perception of reality (that is, if it exists,
otherwise it could be a mere illusion).
A model is an abstraction (omitting tremendous
amount of details) of something for the purpose
of understanding, be it the problem or a
solution.
12/01/12 Amandeep S. Patti 20
21. Three Models
Object model- describes the static structure of
the objects in a system and their relationships. It
contains object diagrams.
Dynamic model- describes the aspects of a
system that change over time. It is used to
specify and implement the control aspects of a
system.
Functional model- describes the data value
transformation within a system. It contains DFD.
DFD represents a computation.
12/01/12 Amandeep S. Patti 21
22. Object Model
It provides the essential framework into
which the dynamic and functional models
can be placed.
Changes and transformations are
meaningless unless there is something to
be changed or transformed.
12/01/12 Amandeep S. Patti 22
23. Dynamic Model
Describes those aspects of a system concerned
with the time and the sequencing of operations-
events that mark changes, sequences of events,
states that define the context for events and the
organisation of events and states.
It describes the sequences of operations that
occur, without regard for what they operations do,
what they operate on, or how they are
implemented.
12/01/12 Amandeep S. Patti 23
24. Functional Model
Describes those aspects of a system
concerned with transformations of values-
functions, mappings, constraints and
functional dependencies.
The functional model captures what a
system does, without regard for how and
when it is done.
12/01/12 Amandeep S. Patti 24
25. How to Do OOAD
Software Lifecycle Review
Systems Engineering
Quality Assurance
Requirements Analysis
Project Planning
Maintenance
Architectural Design
Detailed Design
Implementation
Release
12/01/12 Amandeep S. Patti 25