Object-Oriented Programming with Java Lecture Notes
24 January 2008 • Object-Oriented Programming
Outline
OOP vs. data abstraction.
Effective data abstraction.
OOP facilities.
Limits.
Paradigms
A programming technique.
Support vs. enabling.
Support is pervasive.
Support Quality
Clean, elegant integration in the language.
Integration with other functions.
Few or no corner cases or exceptions.
You pay for only what you use.
Procedural Programming
Programs are procedures manipulating data.
FORTRAN, Algol, Pascal.
Example: is a tic-tac-toe board winning?
bool isWinning(const ttt-board & b) const;
Data Handling
Procedures need data.
What is data.
Data shape affects how a procedure works.
A tic-tac-toe board is a vector or a matrix.
Data Hiding
The procedure data-shape dependence.
Minimize the dependence.
Minimize the data “surface area.”
Present only and exactly the necessary functions.
Example
What's necessary about a tic-tac-toe board?
The contents of individual squares.
Everything else can be derived.
Important to program design.
Data Abstraction
Data hiding decouples procedures and data.
Decoupled data is independent.
Language began to support data abstraction.
This made data and procedures equal.
Consequences
Minimal independent data off-loads work.
Off-loaded work leads to redundancy.
A multiplicity of data leads to complexity.
Object-Oriented Programming
Programming is data-objects interacting.
A program is a model of the problem.
Programming is modelling.
And also analysis and design.
References
What is “Object-Oriented Programming”?
by Bjarne Stroustrup at AT&T Bell Labs, 1991.
This page last modified on 10 September 2007.
This work's
CC license
.