Cs exco
This presentation is the property of its rightful owner.
Sponsored Links
1 / 23

CS ExCo PowerPoint PPT Presentation


  • 97 Views
  • Uploaded on
  • Presentation posted in: General

CS ExCo. Advanced in Topics Object-Oriented Programming. Connections Between: Functional & OO. Section 1: Language History. l -Calculus. Turing Machine. Why Do We Care?. Procedural Practical Little Math Grounding. Functional Programming Impractical Strong Mathematical Properties.

Download Presentation

CS ExCo

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cs exco

CS ExCo

Advanced in Topics

Object-Oriented Programming.


Connections between functional oo

Connections Between:Functional & OO

Section 1:

Language History


Why do we care

l-Calculus

Turing Machine

Why 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


What we want to see

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


A bit of programming languages history

A Bit of ProgrammingLanguages History

Taken From:

  • Gelernter, David Hillel Programming Linguistics MIT Press, 1990

But first…

What is a “Hero” language?


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

Fortran (1957-66)


Fortran abstractions hero

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!

Achieved its goal to replace assembly

Got people to actually use programming languages

Hero? Or Villain?


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 60

“Algol Wall”

Data and program structure

Are separate worlds


Algol 60 hero

Algol 60: Hero?

Yes

  • Discovered Recursive Program Structure.


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

Lisp (60-65)


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

COBOL (1960-61)

A step back, IMHO


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

PL/I (1964) and Algol 68

COMPLEX


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

Pascal (1971-74)

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


Simula 67

Simula 67

The first Object-Oriented Language!

The “Algol Wall” falls at last!

Well, almost


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

Simula 67: the language


Fateful choices

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


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]

Smalltalk (1972-76)


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

Ada (mid 1970s)


C c and eiffel

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


Cs exco

Anonymous Inner Classes

GJ will have pretty good generics semantics

Simplifies C++ greatly

Java

Our Hero


Prototype based oo languages self etc

Prototype 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


Cs exco

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


The future

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


  • Login