The Power of Abstraction The Power of Abstraction Barbara Liskov - - PowerPoint PPT Presentation

the power of abstraction the power of abstraction
SMART_READER_LITE
LIVE PREVIEW

The Power of Abstraction The Power of Abstraction Barbara Liskov - - PowerPoint PPT Presentation

The Power of Abstraction The Power of Abstraction Barbara Liskov October 2009 October 2009 Outline Inventing abstract data types CLU CLU Type hierarchy What next h Data Abstraction Prehistory The Venus machine The


slide-1
SLIDE 1

The Power of Abstraction The Power of Abstraction

Barbara Liskov October 2009 October 2009

slide-2
SLIDE 2

Outline

 Inventing abstract data types  CLU  CLU  Type hierarchy

h

 What next

slide-3
SLIDE 3

Data Abstraction Prehistory

 The Venus machine

slide-4
SLIDE 4

The Interdata 3

slide-5
SLIDE 5

Data Abstraction Prehistory

 The Venus machine  The Venus operating system  The Venus operating system

slide-6
SLIDE 6

Data Abstraction Prehistory

 The Venus machine  The Venus operating system  The Venus operating system  Programming methodology

slide-7
SLIDE 7

Programming Methodology

 The software crisis!

 Machines were getting cheaper  Machines were getting cheaper  And bigger/faster

 E. W. Dijkstra. The Humble

  • Programmer. Cacm, Oct. 1972
slide-8
SLIDE 8

Programming Methodology

 How should programs be designed?  How should programs be structured?  How should programs be structured?

slide-9
SLIDE 9

The Landscape

 E. W. Dijkstra. Go To Statement

Considered Harmful. Cacm, Mar. 1968 Considered Harmful. Cacm, Mar. 1968

slide-10
SLIDE 10

The Landscape

 N. Wirth. Program Development by

Stepwise Refinement. Cacm, April 1971 Stepwise Refinement. Cacm, April 1971

slide-11
SLIDE 11

The Landscape

 D. L. Parnas. Information Distribution

Aspects of Design Methodology. IFIP p g gy Congress, 1971

 “The connections between modules are

the assumptions which the modules make about each other.”

slide-12
SLIDE 12

The Landscape

 D. L. Parnas, On the Criteria to be used

in Decomposing Systems into Modules. in Decomposing Systems into Modules. Cacm, Dec. 1972

slide-13
SLIDE 13

Partitions

 B. Liskov. A Design Methodology for

Reliable Software Systems. FJCC, Dec. Reliable Software Systems. FJCC, Dec. 1972

slide-14
SLIDE 14

Partitions

1 2 3

  • p1 op2 op3

Partition state

slide-15
SLIDE 15

From Partitions to ADTs

 How can these ideas be applied to

building programs? building programs?

slide-16
SLIDE 16

Idea

 Connect partitions to data types

slide-17
SLIDE 17

Meeting in Savanah

 ACM Sigplan-Sigops interface meeting.

April 1973. (Sigplan Notices, Sept. April 1973. (Sigplan Notices, Sept. 1973)

 Started to work with Steve Zilles  Started to work with Steve Zilles

slide-18
SLIDE 18

The Landscape

 Extensible Languages

 S Schuman and P Jourrand Definition  S. Schuman and P. Jourrand. Definition

Mechanisms in Extensible Programming

  • Languages. AFIPS. 1967

 R. Balzer. Dataless Programming. FJCC

1967

slide-19
SLIDE 19

The Landscape

 O-J. Dahl and C.A.R. Hoare. Hierarchical

Program Structures. Structured Program Structures. Structured Programming, Academic Press, 1972

slide-20
SLIDE 20

The Landscape

 J. H. Morris. Protection in Programming

  • Languages. Cacm. Jan. 1973
  • Languages. Cacm. Jan. 1973
slide-21
SLIDE 21

The Landscape

 W. Wulf and M. Shaw. Global Variable

Considered Harmful. Sigplan Notices. Considered Harmful. Sigplan Notices.

  • Feb. 1973.
slide-22
SLIDE 22

Abstract Data Types

 B. Liskov and S. Zilles. Programming

with Abstract Data Types. ACM Sigplan yp gp Conference on Very High Level

  • Languages. April 1974
slide-23
SLIDE 23

What that paper proposed

 Abstract data types

 A set of operations  A set of operations  And a set of objects  The operations provide the only way to use  The operations provide the only way to use

the objects

slide-24
SLIDE 24

What that paper proposed

 Abstract data types

 Clusters with encapsulation  Clusters with encapsulation

 Polymorphism

St ti t h ki ( h d)

 Static type checking (we hoped)  Exception handling

slide-25
SLIDE 25

From ADTs to CLU

 Participants

 Russ Atkinson  Russ Atkinson  Craig Schaffert  Alan Snyder  Alan Snyder

slide-26
SLIDE 26
slide-27
SLIDE 27

Why a Programming Language?

 Communicating to programmers  Do ADTs work in practice?  Do ADTs work in practice?  Getting a precise definition

h bl f

 Achieving reasonable performance

slide-28
SLIDE 28

Language Design

 Goals

 Ease of use  Ease of use  Simplicity  Expressive power  Expressive power  Performance

slide-29
SLIDE 29

Language Design

 More goals

 Minimality  Minimality  Uniformity  Safety  Safety

slide-30
SLIDE 30

Some Assumptions/Decisions

 Heap-based with garbage collection!  No block structure!  No block structure!  Separate compilation

h k

 Static type checking

slide-31
SLIDE 31

More Assumptions/Decisions

 No concurrency  No go tos  No go tos  No inheritance

slide-32
SLIDE 32

CLU Mechanisms

 Clusters  Polymorphism  Polymorphism  Exception handling  Iterators

slide-33
SLIDE 33

Clusters

IntSet = cluster is create, insert, delete, isIn, … d I tS t end IntSet

slide-34
SLIDE 34

Clusters

IntSet = cluster is create, insert, delete, … end IntSet IntSet s := IntSet$create( ) IntSet s := IntSet$create( ) IntSet$insert(s, 3)

slide-35
SLIDE 35

Clusters

IntSet = cluster is create, insert, delete, … [i t] rep = array[int]

slide-36
SLIDE 36

Clusters

IntSet = cluster is create, insert, delete, … [i t] rep = array[int] create = proc ( ) returns (cvt) create = proc ( ) returns (cvt) return (rep$create( )) end create e d c eate

slide-37
SLIDE 37

Polymorphism

Set = cluster[T: type] is create, insert, … end Set Set[int] s := Set[int]$create( ) Set[int]$insert(s 3) Set[int]$insert(s, 3)

slide-38
SLIDE 38

Polymorphism

Set = cluster[T: type] is create, insert, … where T has equal: proctype(T, T) q p yp ( , ) returns (bool)

slide-39
SLIDE 39

Polymorphism

Set = cluster[T: type] is create, insert, … where T has equal: proctype(T, T) returns (bool) rep = array[T] insert = proc (x: cvt, e: T) … if e = x[i] then …

slide-40
SLIDE 40

Exception Handling

 J. Goodenough. Exception Handling:

Issues and a Proposed Notation. Cacm, Issues and a Proposed Notation. Cacm,

  • Dec. 1975

 Termination vs. resumption  Termination vs. resumption  How to specify handlers

slide-41
SLIDE 41

Exception Handling

choose = proc (x: T) signals (empty) if rep$size() = 0 then signal empty if rep$size() = 0 then signal empty …

slide-42
SLIDE 42

Exception Handling

choose = proc (x: T) signals (empty) if rep$size() = 0 then signal empty if rep$size() = 0 then signal empty … t[T]$ h () set[T]$ choose() except when empty: …

slide-43
SLIDE 43

Exception Handling

 Handling  Propagating  Propagating  Shouldn’t happen

Th f il ti

 The failure exception

 Principles

 Accurate interfaces  Avoid useless code

slide-44
SLIDE 44

Iterators

 For all x in C do S

slide-45
SLIDE 45

Iterators

 For all x in C do S

 Destroy the collection?  Destroy the collection?  Complicate the abstraction?

slide-46
SLIDE 46

Visit to CMU

 Bill Wulf and Mary Shaw, Alphard  Generators  Generators

slide-47
SLIDE 47

Iterators

sum: int := 0 for x: int in Set[int]$members(s) do [ ]$ ( ) sum := sum + x end end

slide-48
SLIDE 48

Iterators

Set = cluster[T] is create, …, members, … rep = array[T] members = iter (x: cvt) yields (T) for z: T in rep$elements(x) do yield (z) end

slide-49
SLIDE 49

After CLU

 Argus and distributed computing  Type Hierarchy  Type Hierarchy

slide-50
SLIDE 50

The Landscape

 Inheritance was used for:

 Inplementation  Inplementation  Type hierarchy

slide-51
SLIDE 51

Implementation Inheritance

 Violated encapsulation!

slide-52
SLIDE 52

Type hierarchy

 Wasn’t well understood  E g

stacks vs queues

 E.g., stacks vs. queues

slide-53
SLIDE 53

The Liskov Substitution Principle (LSP)

 Objects of subtypes should behave like

those of supertypes if used via those of supertypes if used via supertype methods

 B. Liskov. Data abstraction and

hierarchy Sigplan notices May 1988

  • hierarchy. Sigplan notices, May 1988
slide-54
SLIDE 54

Polymorphism

 where T has … vs.  where T subtype of S  where T subtype of S

f h d ff

 Proofs happen at different times!

slide-55
SLIDE 55

What Next?

 Modularity based on abstraction is the

way things are done way things are done

slide-56
SLIDE 56

Modern Programming Languages

 Are good!

slide-57
SLIDE 57

Missing Features

 Procedures are important  And closures and iterators  And closures and iterators  Exception handling

l

 Built-in types  Can’t we do better for “serialization”?

slide-58
SLIDE 58

The state of programming

 Isn’t great!  Especially web services and browsers  Especially web services and browsers  Return of globals

slide-59
SLIDE 59

An aside: persistent storage typically violates abstraction

 E.g., a file system or a database  It’s a big space of globals!  It s a big space of globals!  Without support for encapsulation

b ld b h b

 An object store would be much better

 Automatic translation  Type preservation

slide-60
SLIDE 60

Programming language research

 New abstraction mechanisms?  Concurrency  Concurrency

 Multi-core machines

Di t ib t d t ?

 Distributed systems?

slide-61
SLIDE 61

Systems research

 Has done well

 Distributed hash tables  Distributed hash tables  Map-reduce  Client/server  Client/server  Distributed information flow  …

slide-62
SLIDE 62

A Concern

 Performance isn’t the most important

issue issue

 vs. semantics  vs simplicity  vs. simplicity

 E.g., one-copy consistency

Failures should be catastrophes

 Failures should be catastrophes

slide-63
SLIDE 63

Systems Problems

 Internet Computer

 Storage and computation  Storage and computation  Semantics, reliability, availability, security

Massively parallel machines

 Massively parallel machines

slide-64
SLIDE 64

The Power of Abstraction The Power of Abstraction

Barbara Liskov October 2009 October 2009