Professional Documents
Culture Documents
Roadmap
abstraction mechanisms
We will present a short
Abstraction
Abstraction is the purposeful suppression, or hiding,
of some details of a process or artifact,
In order to bring out more clearly other aspects,
details, or structure
Information Hiding
Purposeful omission of details in the
Abstraction in an Atlas
Levels of Abstraction in
Object Oriented Programs
At the highest level of abstraction we view a
program as a community of interacting objects
(and interacting programmers).
Client
Server
10
$2.00
$1.00
$0.75
11
interface Stack {
public void push (Object val);
public Object top () throws EmptyStackException;
public void pop () throws EmptyStackException;
}
Levels of Abstraction
An Implementation
12
13
14
Summary:
Levels of Abstraction
Interface
Implementation
Strategy
Methods
15
level of abstraction,
And, more importantly, what details should be omitted
One does not want to ignore or
Abstraction
16
Forms of Abstraction
Division into parts
Specialization
Multiple views
17
18
Has-A Abstraction
Division into parts takes a complex
system, and divides into component
parts, which can then be considered in isolation.
Characterized by sentences that have the
words has-a:
A car has-an engine, and has-a transmission
19
Is-a Abstraction
Is-a abstraction takes a complex
system, and views it as an instance of
a more general class
Characterized by sentences that have the
words is a:
A car is a wheeled vehicle, which is-a means of
transportation
20
Encapsulation and
Interchangeability
An important aspect of division into parts is to
21
provided as described.
Joes Data Structure Warehouse
Services offered:
void push(Object val);
Object top();
void pop();
$2.00
$1.00
$0.75
23
modules.
A system with many dependencies has high
coupling.
Good systems have low coupling
24
Degree of Coupling
The degree of coupling between two components can be
qualitatively measured by determining the effects of changing
the contract or interface between two components or systems.
For example:
What would happen if you added or deleted a property from a class?
What would happen if you changed the data type of a column in a table?
What would happen if you added a column to a table?
What would happen if your database server changed from SQL Server to
mySQL or Oracle?
The degree of pain that each of these changes would cause you
is a good qualitative measurement of how tightly coupled your
components are to the components they depend on
25
combination
26
Example of Composition
Regular Expressions
27
(empty string) denoting the set containing only the "empty" string, which has no
characters at all.
(Kleene star) denoting the smallest superset of that contains and is closed
under string concatenation.
This is the set of all strings that can be made by concatenating any finite number
and ,
= {, , , , , , , , , }.
28
Design Patterns
Patterns are another attempt to document and
reuse abstractions
Client
Proxy
Server
29
Assembly languages
ii.
Procedures
iii.
Modules
iv.
ADT
v.
vi.
Objects
30
31
Assembly Languages
Assembly languages and linkers were perhaps the first
tools used to abstract features of the bare machine.
Addresses could be represented symbolically, not as a
number
Binary
10110000 01100001
Hexa.
B0 61
ASM
32
of information hiding
33
Information Hiding
The Problem of Stacks
int datastack[100];
int datatop = 0;
void init() // initialize the stack
{ datatop = 0; }
void push(int val) // push a value on to the stack
{ if (datatop < 100) datastack [datatop++] = val; }
int top() // get the top of the stack
{ if (datatop > 0) return datastack [datatop - 1]; else return 0; }
int pop() // pop element from the stack
{ if (datatop > 0) return datastack [--datatop]; else return 0; }
34
Modules
35
Parnas's Principles
David Parnas described two principles for the
proper use of modules:
One must provide the intended user of a module
36
37
38
Functionality of
the application
services provided
by objects in the
application
39
to behavior
Classes -- a way of organization that permits
40
Core Target
Platforms
Pervasive
Services
41