Table of Contents
CSE583: Programming Languages
Administrivia
Lecture schedule
Object oriented programming languages
A few OO languages
Object Oriented
Dimensions of OO
OO has three key thrusts
Anything else central to OO?
Abstract data types
Information hiding
ADTs
ADTs
Aside: any weaknesses of information hiding?
Classes
The classic example: a stack
Two implementations
Inheritance
Inheritance
Example
Benefits of inheritance
Classic hierarchies
Rich OO hierarchies
The world is not perfectly hierarchical
Pitfalls of inheritance
Dynamic binding
Dynamic binding (more)
Method lookup
Example: displaying shapes in list
Benefits of dynamic binding
Pitfalls of dynamic binding
Time for questions and comments
Types
Name vs. structural equivalence
Polymorphism
Strachey (1967)
Cardelli and Wegner (1985)
Definitions
More definitions
Universal polymorphism
Inheritance (Cardelli/Wegner)
How do we determine if a type A is a subtype of a type B?
Example
OO languages have methods, too
Example
Further example
Note carefully
Contravariant typing
Example
Contravariant?
Covariance
Some issues in OOP
Hybrid vs. pure object model
Why hybrid?
Class-based vs. classless languages
How does it work? Delegation
How does it work?
How to create objects?
The Smalltalk-80
Metaclasses
Single vs. multiple dispatching
But…
Multiple dispatch
Static type checking
Next week
|
Author: David Notkin
Email: notkin@cs.washington.edu
Home Page: http://www.cs.washington.edu/education/courses/583
Download presentation source
|