1. Lawrence Chung CS6359.OT1: Module 1 1
Module 1: Introduction to OOAD
(Object-Oriented Analysis and Design)
2. Lawrence Chung CS6359.OT1: Module 1 2
References
Object-Oriented Modeling and Design, Rumbaugh, et.al, Prentice
Hall
The Unified Modeling Language User Guide, Booch, et.al.
Design Patterns; Elements of Reusable Object-oriented Software;
Gamma, et.al.
Appying UML and Patterns, Craig Larman
Visual Modeling with Rational Rose and UML, Terry Quatrani 1998
Object-Oriented Methods: A Foundation, James Martin, et. al, 1995
4. Lawrence Chung CS6359.OT1: Module 1 4
Why Object-Oriented?
“The "software crises" came about when people realized the major problems in
software development were not algorithmic, but were caused by communication
difficulties and the management of complexity” [Budd]
The Whorfian Hypothesis:
The language in which an idea is thought or expressed colors or directs in a very
emphatic manner the nature of the thought
What kind of language can alleviate difficulties with
communication & complexity well?
5. Lawrence Chung CS6359.OT1: Module 1 5
Why Object-Oriented?
– Consider Human Growth & Concept Formation
Communication & complexity about the problem and the solution, all expressed in terms of
concepts in a language!
But then, What is CONCEPT? [Martin & Odell]
Consider Human Growth & Concept Formation
stage concepts
infant the world is a buzzing confusion
very young age "blue" "sky“ (individual concepts)
"blue sky“ (more complex concept)
hypothesis: humans possess an innate
capacity for perception
getting older -> increased meaning, precision, subtlety,
...
the sky is blue only on cloudless days
the sky is not really blue
it only looks blue from our planet Earth
because of atmospheric effects
elaborate conceptual constructs
Concept formation: from chaos to order!
6. Lawrence Chung CS6359.OT1: Module 1 6
Why Object-Oriented?
- concepts and objects
So, concepts are needed to bring order into the problem and the solution
But, What is CONCEPT? [Martin & Odell] [Novak, 1984, Cambridge University Press]
Study of a first grade class
When given a list of concepts (water, salt water, Oceans, Penguins,...),
Harry constructed a concept diagram through which he understands his world and
communicates meaning
A "concept" is an idea or notion that we apply to the things, or objects, in our awareness
7. Lawrence Chung CS6359.OT1: Module 1 7
Object-Orientation (OO) = Being “conceptual”
OO analysis & design = “Conceptual” analysis & design
But for what?
for Modeling!
Analysis for Model of the problem
design for Model of the solution
“conceptual” analysis for “conceptual” model of the problem
“conceptual” design for “conceptual” model of the solution
Why Object-Oriented?
… for Conceptual Modeling Reasons
What kind of language is used to create this concept diagram, or Harry’s mental image?
What are the building blocks of Harry’s perception of this piece of reality,
represented in his mind/brain?
8. Lawrence Chung CS6359.OT1: Module 1 8
Why Object-Oriented ->
What is a model?
A model is a simplification of reality.
E.g., a miniature bridge for a real bridge to be built
Well...sort of….but not quite
A model is our simplification of our perception of reality
(that is, if it exists, otherwise it could be a mere illusion).
Your perception, my perception, his, hers, …, =>
communication is not about reality but about
your/my/his/her perception of reality =>
validation and verification hard but needed
A model is an abstraction(omitting tremendous amount of details) of
something for the purpose of understanding, be it the
problem or a solution.
A model (like Harry’s) is expressed in terms of concepts in a language!
9. Lawrence Chung CS6359.OT1: Module 1 9
Encapsulation
a.k.a. information hiding
Objects encapsulate:
state as a collection of instance variables
behavior as a collection of methods invoked by
messages
Abstraction
Focus on the essential
Focus on what an object “is and does”
Omits tremendous amount of details
What is Object-Orientation
- Abstraction and Encapsulation
10. Lawrence Chung CS6359.OT1: Module 1 10
Class Car
Attributes
Model
Location
Operations
Start
Accelerate
What is Object-Orientation
- Example of Abstraction and Encapsulation
11. Lawrence Chung CS6359.OT1: Module 1 11
What is Object-Orientation?
- Object
What is OBJECT?
A "concept" is an idea or notion that we apply to the things, or objects, in
our awareness
An "object" is anything to which a concept applies.
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. Lawrence Chung CS6359.OT1: Module 1 12
What is Object-Orientation?
- Class
What is CLASS?
a collection of objects that share common properties, attributes, behavior and semantics,
in general.
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.
A factory for instantiating objects.
The description of a collection of related components.
Classification
Grouping of common objects into a class
Instance.
An object created by a class.
Instantiation.
The act of creating an instance.
Cf. Containment.
Objects that contain other objects as components.
13. Lawrence Chung CS6359.OT1: Module 1 13
What is Object-Orientation
- Subclass vs. Superclass
• Specialization
The act of defining one class as a refinement of another.
• Subclass
A class defined in terms of a specialization of a superclass
using inheritance.
• Superclass
A class serving as a base for inheritance in a class hierarchy
• Inheritance
Automatic duplication of superclass attribute and behavior
definitions in subclass.
What is generalization? What is over-generalization?
14. Lawrence Chung CS6359.OT1: Module 1 14
What is Object-Orientation?
-State
What is STATE?
"State" is a collection of association an object has with other
objects and object types.
What is STATE CHANGE?
A "state change" is the transition of an object from one state to another.
What is EVENT?
An "event" is a noteworthy change in state.
15. Lawrence Chung CS6359.OT1: Module 1 15
An object (sender) sends a request (message) to another object (receiver) to
invoke a method of the receiver object’s.
A message is similar to a function call, but different
a message must somehow reference the intended recipient object
the recipient object only responds to the protocol, i.e., a
predetermined set of messages defined by its class.
What is Object-Orientation
– More about Message
Fn
Data
Fn
Data
Sender object Receiver object
message
16. Lawrence Chung CS6359.OT1: Module 1 16
What is Object-Orientation?
- Object-Oriented Application
•Collection of discrete interacting objects
•Objects have behavior and state
•Inter-object communication through message passing
Fn
Data
Fn
Data
Fn
Data
17. Lawrence Chung CS6359.OT1: Module 1 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 — Analysis is object-oriented and design is object-
oriented. A software development approach that emphasizes a
logical solution based on objects.
18. Lawrence Chung CS6359.OT1: Module 1 18
Systems Engineering
Requirements Analysis
Project Planning
Architectural Design
Detailed Design
Implementation
Release
Maintenance
Quality
Assurance
Software Lifecycle Review
How to Do OOAD
– Where to Use OO?
Where to use OO in software lifecycle? Where in this course?
19. Lawrence Chung CS6359.OT1: Module 1 19
How to Do OOAD
– OMT as Object-Oriented Methodology
OMT (Object Modeling Technique) by James Rumbaugh
Object Model: describes the static
structure of the objects in the system
and their relationships
-> Object Diagrams.
Dynamic Model: describes the
interactions among objects in the system
-> State Diagrams.
Functional Model: describes the data
transformation of the system
-> DataFlow Diagrams.
20. Lawrence Chung CS6359.OT1: Module 1 20
Analysis: Model the real world showing its
important properties; Concise model of
what the system will do
System Design: Organize into
subsystems based on analysis structure
and propose architecture
Object Design: Based on analysis model
but with implementation details; Focus on
data structures and algorithms to
implement each class; Computer and
domain objects
Implementation: Translate the object
classes and relationships into a
programming language
How to Do OOAD
– OMT as Object-Oriented Methodology
OMT (Object Modeling Technique) by James Rumbaugh
21. Lawrence Chung CS6359.OT1: Module 1 21
How to Do OOAD
- Historical Perspective
OO Prog. Languages
(Smalltalk, C++)
just program!
OO Design
(Booch) design then
program
OO Analysis
(Rumbaugh, Jacobson)
Process Perspective
OO Technology
Analyze (use case) first,
then design,
T then program
22. Lawrence Chung CS6359.OT1: Module 1 22
How to Do OOAD
- OO Development Processes
Fusion
Hewlett Packard
Recommended Process and Models
ObjectSpace best practices
Larman’s experiences
The Rational Unified Process (RUP)
Rational; Booch, Jacobson, and Rumbaugh
Some Popular OOAD Processes
23. Lawrence Chung CS6359.OT1: Module 1 23
How to Do OOAD
– One Good Way: Use (OO) Design Patterns
Reusable solutions to typical problems.
“Each design pattern systematically names, explains, and evaluates an
important and recurring design in object-oriented systems.” [Gamma]
Name — identifies a particular pattern, creating a vocabulary.
Problem — identifies context when pattern should be applied.
Solution — an abstract description of a design problem along with a template
object design that solves the problem.
Consequences — results and trade-offs of applying the pattern.
24. Lawrence Chung CS6359.OT1: Module 1 24
Introduction to OOAD - Summary
Why
Software Crisis due to Communication and Complexity
Languages, Concepts, Models
OO for Conceptual Modeling
Historical Perspective of Modeling Paradigms
What
Fundamental OO Concepts
How
Design patterns & OO development processes
25. Lawrence Chung CS6359.OT1: Module 1 25
Introduction to OOAD - Points to Ponder
1. How do you think your mental image is represented?
2. What kinds of languages are used for what purpose in our daily life?
3. What are the differences among a concept, a model and a language?
4. What are the differences between a language and a methodology?
5. Can we use C# for analysis?
6. If C++ is a language, does it model anything? If so, what?
7. What does a concept in C++ refer to (i.e., semantics)?
8. What does a concept in a (OO) design refer to?
9. What does a concept in an (OO requirements) analysis refer to?
10. Is the current OOAD for Functional Analysis and Design, or Non-
Functional Analysis and Design?
11. What is the relationship between OO (Object-Orientation) and GO
(Goal-Orientation), between OO and AO (Agent-Orientation), and
between GO and AO?
12. Can you prove you and I communicate with each other perfectly?
26. Lawrence Chung CS6359.OT1: Module 1 26
Module 1: Introduction to OOAD
- Appendix
(Object-Oriented Analysis and Design)
27. Lawrence Chung CS6359.OT1: Module 1 27
Why Object-Oriented
– Why Do We Model?
To understand why a software system is needed, what
it should do, and how it should do it.
To communicate our understanding of why, what and
how.
To detect commonalities and differences in your
perception, my perception, his perception and her
perception of reality.
To detect misunderstandings and miscommunications.
For just about everything!
28. Lawrence Chung CS6359.OT1: Module 1 28
Why Object-Oriented
- Importance of Conceptual Modeling Once More
No reason to build a system for which there is no
reason to -> understand the reason – part of the
problem, hence analysis
No way to build a system for which there is no
understanding of its structure, parts and relationships
-> understand the solution, hence design
We build models of complex systems because we
cannot understand such a system in its entirety…
Without conceptual models of complex systems, both problems and
solutions, we cannot understand such a system in its entirety.
Object-Orientation is for conceptual modeling!
Cf. Representing people in a stack is not conceptual in the problem space.
29. Lawrence Chung CS6359.OT1: Module 1 29
Knowledge
Representation (in A.I.)
Psychological Validity
Philosophical Validity
Computational Validity
Databases
Emphasis in Persistent Data
RelationalDB
Network DB
Hierarchical DB
OODB
Programming Languages
Emphasis in Efficiency
Simula, SmallTalk, C++, Protel,
Java
ERD
SDM
CM
ADT
ERD: Entity Relationship Diagram
SDM: Semantic Data Model
ADT: Abstract Data Type
CM: Conceptual Model
Why Object-Oriented
- Who’s Behind Object-Orientation
What role does Software Engineering play?
30. Lawrence Chung CS6359.OT1: Module 1 30
Why Object-Oriented?
- Communication & Complexity about Problem and Solution
So, let us try to Communicate well and Conquer the complexity well
But about what? …about what is really critical…
Experience shows:
DEFINING THE "PROBLEM" (analysis) is THE "PROBLEM“
ARCHITECTURAL DESIGN (the highest level of solution) can, literally, make it or
break it (high-level design)
So, let us try to Communicate well and Conquer the complexity well
about analysis and design!
Common wisdom says: "Divide and Conquer"
-> decompose the problem & the solution into manageable parts
This can help (methodologically) with
adaptability, parallel development and deployment of the system, etc.
But still, what kind of language can alleviate difficulties with communication &
complexity well about the analysis and the design, and suited well to the divide
and conquer methodology?
34. Lawrence Chung CS6359.OT1: Module 1 34
Why Object-Oriented
– Why Shift in Modeling Paradigm
From Functional
Functions as building blocks (fn: Input -> Output)
Algorithmic perspective
E.g., Lisp
To Object-Oriented
Objects as building blocks.
Conceptual perspective
from the vocabulary of the problem space for analysis
from the vocabulary of the solution space for design
35. Lawrence Chung CS6359.OT1: Module 1 35
Decompose system functionality
Identify concepts, in
terms of both function
and data together
Fn
e.g., Structure Chart
Data
Updated Read
Data
Data
Updated Read
Data
Fn
Data
Data
Why Object-Oriented –
Functional Object-Oriented
Fn
36. Lawrence Chung CS6359.OT1: Module 1 36
Why Object-Oriented
- Why Away From Functionally Structured Solution
Product quality is static or worsening, & increased
testing
Increasing number of manpower - programmers
Long lead time, 2+ years for new commercial
applications development
Significant amount of maintenance efforts & delay in
adaptation to new hardware
37. Lawrence Chung CS6359.OT1: Module 1 37
Why Object-Oriented
- Programming Language Perspective
First Generation (1954-1958)
Fortran I
Second Generation (1959-1961)
Fortran II, Algol, Cobol
Third Generation (1962-1970)
PL/I, Pascal
Object-Oriented Languages
Smalltalk, C++, Java
38. Lawrence Chung CS6359.OT1: Module 1 38
1st Generation 2nd Gen
Global Data
Subroutines
Fortran I and Algol 58
Global Data
.
....Local
Data
....Local
Data
....Local
Data
Global Data
.
....Local
Data
....Local
Data
....Local
Data
Fortran II, Algol, Cobol
39. Lawrence Chung CS6359.OT1: Module 1 39
3rd Generation Object Oriented
Global Data
Subroutines
.
....Local
Data
and
Code
...Local
Data
and
Code
...Local
Data
and
Code
Fn
Data
Fn
Data
Fn
Data
Allocation of functionality to objects
Shift from monolithic to decentralized control
Object-Oriented Programming Languages (OOPL)
PL/I, Pascal
40. Lawrence Chung CS6359.OT1: Module 1 40
What is Object-Orientation
- Abstract Class vs. Concrete Class
Abstract Class.
An incomplete superclass that defines common
parts.
Not instantiated.
Concrete class.
Is a complete class.
Describes a concept completely.
Is intended to be instantiated.
41. Lawrence Chung CS6359.OT1: Module 1 41
What is Object-Orientation
– Operation vs. Message vs. Method
What is OPERATION?
An "operation" is a process that can be requested as a unit.
It is the mechanism for state change (i.e., event).
- Behavior across different kinds of objects
What is MESSAGE?
- specify what behavior receiver objects need to perform
- details of how to perform are left up to the receiver
- state information is accessed via messages
What is METHOD?
- specify how operations are to be carried out (hence implements a message)
- must have access to data
- can manipulate data directly
- Specific implementation of an operation by a certain class
42. Lawrence Chung CS6359.OT1: Module 1 42
setGrade()
getGrade()
What is Object-Orientation
- Interfaces
• All data should be hidden within a class.
• make all data attributes private
• provide public methods (accessor methods) to get and set the data
values
• e.g. Grade information is usually confidential, hence it should be kept
private to the student. Access to the grade information should be
done through interfaces, such as setGrade() and getGrade()
Fn
Data
43. Lawrence Chung CS6359.OT1: Module 1 43
What is Object-Orientation
– How It All Fits Together?
An application is a set of objects that interact by
sending messages
An object’s functionality is invoked by sending a
message
An object’s functionality is implemented by methods
The data needed to support an object’s functionality is
stored locally within an object
All application code must be associated with some
object
44. Lawrence Chung CS6359.OT1: Module 1 44
What is Object-Orientation
- Polymorphism
The same operation may behave differently in different classes.
Objects of different classes respond to the same message differently.
In-state Student
Out-of-State
Student
payTuition ()
45. Lawrence Chung CS6359.OT1: Module 1 45
OOPL: Simula
Developed for discrete event simulation (1967)
Simulation modeling is a hard problem for
conventional languages
Simulated objects must interact and change state in
many different and often unpredictable ways
Simulation can solve problems that are too complex
for mathematical equations
Simulation objects are usually easy to identify and
communicate via message passing
46. Lawrence Chung CS6359.OT1: Module 1 46
OOPL: Smalltalk
From Xerox PARC, by Alan Kay and Adele Goldberg
Towards a small language for anyone to use on a PC
Influenced by Simula: objects and classes
Influenced The WIMP interface
(Windows, Icons, Menu, Pointing device)
Influenced Apple’s design of Lisa and Macintosh
47. Lawrence Chung CS6359.OT1: Module 1 47
OOPL: C++
From AT&T Bell Labs – invented by Bjorne Stroustrup
http://www.research.att.com/~bs/C++.html
Adds object-oriented features to C
Classes in C++ correspond to types in C
48. Lawrence Chung CS6359.OT1: Module 1 48
OOPL: Ada95
DOD support for embedded systems
Enforces Abstract Data Types (ADTs)
Data, operations on data, constraints on operations
E.g., formal specification languages - Larch, Z, VDM
Support for multitasking and exceptions
Large and complex
49. Lawrence Chung CS6359.OT1: Module 1 49
OOPL: Java
Like C++ in syntax
Like Smalltalk in Structure and design
Without the drawbacks to C++ and Smalltalk
Frees the programmer from having to manage
memory (accidental complexity)
Small footprint (memory requirement)
No pointers, pointer arithmetic, structs, typedefs,
preprocessor directives (#define), malloc and free
With extensive type checking, true arrays with
array bounds checking, null pointer checking,
automatic garbage collection