Title: CS ExCo
1CS ExCo
- Advanced in Topics
- Object-Oriented Programming.
2Connections Between Functional OO
- Section 1
- Language History
3Why Do We Care?
- Procedural
- Practical
- Little Math Grounding
- Functional Programming
- Impractical
- Strong Mathematical
- Properties
- Object-Oriented
- Very Practical
- (fixes problems)
- No Math Basis/
- Chaos Theory
4What We Want to See
- Functional Programming
- Impractical
- Strong Mathematical
- Properties
- Object-Oriented
- Very Practical
- (fixes problems)
- No Math Basis/
- Chaos Theory
Future OO Very practical Many Nice Mathematical
properties
5A Bit of ProgrammingLanguages History
- Taken From
- Gelernter, David Hillel Programming Linguistics
MIT Press, 1990
But first
What is a Hero language?
6Fortran (1957-66)
- Program Structure
- Flat
- No recursion
- No nested scopes
- No statement grouping
- No control structures
- goto computed goto
- if (like computed goto)
- do (based around labels)
- Static
- Data Structure
- Flat
- Arrays
- Later strings
- Only locals globals
- Static
- No dynamic allocation
- All locations picked at compile time
7FortranAbstractions? Hero?
- Functions/Procedures
- Absolutely no layered abstraction
- Layered Abstraction first understand in general
or in the abstract whats going on then worry
about the details. Apply recursively for best
effect - At Least its consistent
Hero! Achieved its goal to replace assembly Got
people to actually use programming languages
Hero? Or Villain?
8Algol 60
- Program Structure
- Recursive
- Nested scopes
- Modules
- Recursive function calls
- Full set of control structures
- Static
- Data Structure
- Flat
- Arrays
- No records
- Dynamic
- Dynamically sized arrays
Algol Wall Data and program structure Are
separate worlds
9Algol 60 Hero?
Yes
- Discovered Recursive Program Structure.
10Lisp (60-65)
- Program Structure
- Recursive
- Structure
- Calls
- Static
- Functions still arent first class values
- Dynamic Binding
- variables are bound within the calling environment
- Data Structure
- Recursive
- Atoms
- Lists
- Heterogeneous Lists
- Dynamic
- Garbage collection
- No records
11COBOL (1960-61)
- Program Structure
- Flat
- Back to this again
- No parameter accepting subroutines
- No nested scopes
- Static
- Data Structure
- Records
- FINALLY!
- Tied to files
- Not templates for records
- Static
- No dynamic allocation
A step back, IMHO
12PL/I (1964) and Algol 68
- PL/I for example
- DECLARE FOOBAR DECIMAL FIXED REAL (8,3)
STATIC EXTERNAL - Algol 68
- Allows anything, for example
- this is an acceptable name for a variable of type
integer - Operator overloading, unions, pointers to
anything, Call-by-reference - Everything is first class and transparent,
including procedures - Yet procedures are objects while structs extend
the language, structures are based on arrays and
one has data and programs and never shall the
twain meet
COMPLEX
13Pascal (1971-74)
- Program Structure
- Partially recursive
- Procedures with recursive calls
- No true blocks, only compound statements
- Static
- Data Structure
- Flat
- Records
- Dynamic
- Record types extend type system
- Based on arrays
- Strongly typed
Most importantly its simple! This temporarily
reversed the trend.
In an array structure, all components are of the
same type. In a record, the components (called
fields) are not necessarily of he same
type -Wirth
14Simula 67
The first Object-Oriented Language!
The Algol Wall falls at last!
Well, almost
15Simula 67 the language
- Program Structure
- Recursive
- Same as others
- Data Structure
- Recursive
- Dynamic
- Classes Objects
- Classes instantiate objects
- Classes have code and take parameters
- Inheritance
16Fateful Choices
- Broke down the Algol Wall by making data like
procedures - We loose a way to describes object instances,
just as there is no way to describe procedure
instances - Classes and
- procedures are
- the same but
- distinguished
- by syntax as
- different
class ACCOUNT(balance) real balance begin
integer acctNum accrNum getNextAcctNum()
procedure DEPOSIT(amount) real
amount balance balance
amount end ref (ACCOUNT) MyAcct MyAcct -
new ACCOUNT(45)
17Smalltalk (1972-76)
- No primitives
- Classes are objects
- Even blocks are objects
- Dynamically typed
- Extremely uniform
- Despite all this, it never was quite it
- Syntax is nearly unreadable, example
- Given a Point class the plus method might be
- pt Point new x xpt x y ypt y
18Ada (mid 1970s)
- A complicated language designed for the DOD
- Based on Pascal
- Many different forms of packaging and data type
declarations - Strong typing with the flexibility of making new
types - Security was important (unlike Smalltalk and
Scheme) - No quite Object-Oriented
19C, C and Eiffel
- C gave us for blocks and lots of other nice
syntax - C made OO and exceptions mainstream
- Const allows expression of invariance
- Eiffel is in the Pascal family
- It is a well thought out OO language
- Gave us the concept of whole program optimization
- Hopefully the last of the Pascal line
20Java
- Anonymous Inner Classes
- GJ will have pretty good generics semantics
- Simplifies C greatly
Our Hero
21Prototype Based OO LanguagesSelf etc.
- No classes, only objects
- New objects are made by cloning others
- A class is just an object you use as a template
- Can directly write objects and often add
methods/properties on the fly - May be strongly or weakly typed
22BETA
- Everything is a pattern
- Patterns make up classes and methods
- There is no direct representation of an object
- Very similar to functional languages like Scheme
- Strongly typed
23The Future?
- Patterns are first class entities representing
classes and methods - Direct object representations allow inner objects
and modules - Ways to express invariance
- Anonymous patterns and objects
- Integration of Generics into the polymorphism
system