Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS ExCo Advanced in Topics Object-Oriented Programming.

Similar presentations

Presentation on theme: "CS ExCo Advanced in Topics Object-Oriented Programming."— Presentation transcript:

1 CS ExCo Advanced in Topics Object-Oriented Programming.

2 Connections Between: Functional & OO Section 1: Language History

3 Why Do We Care? -Calculus Functional Programming Impractical Strong Mathematical Properties Procedural Practical Little Math Grounding Object-Oriented Very Practical (fixes problems) No Math Basis/ Chaos Theory Turing Machine

4 What 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

5 A Bit of Programming Languages History Taken From: Gelernter, David Hillel Programming Linguistics MIT Press, 1990 But first… What is a “Hero” language?

6 Fortran (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

7 Hero! Achieved its goal to replace assembly Got people to actually use programming languages Fortran: Abstractions? Hero? Functions/Procedures Absolutely no layered abstraction Layered Abstraction: “first understand in general or in the abstract what’s going on; then worry about the details.” Apply recursively for best effect At Least its consistent Hero? Or Villain?

8 Algol 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

9 Algol 60: Hero? Discovered Recursive Program Structure. Yes

10 Lisp (60-65) Program Structure Recursive Structure Calls Static Functions still aren’t first class values Dynamic Binding variables are bound within the calling environment Data Structure Recursive Atoms Lists Heterogeneous Lists Dynamic Garbage collection No records

11 COBOL (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

12 PL/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

13 “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 Pascal (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.

14 Simula 67 The first Object-Oriented Language! The “Algol Wall” falls at last! Well, almost

15 Simula 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

16 Fateful 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);

17 Smalltalk (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: x+pt x y: y+pt y]

18 Ada (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

19 C, 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

20 Java Anonymous Inner Classes GJ will have pretty good generics semantics Simplifies C++ greatly Our Hero

21 Prototype Based OO Languages Self 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

22 BETA 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

23 The 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

Download ppt "CS ExCo Advanced in Topics Object-Oriented Programming."

Similar presentations

Ads by Google