The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL - - PowerPoint PPT Presentation

the power of abstraction
SMART_READER_LITE
LIVE PREVIEW

The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL - - PowerPoint PPT Presentation

The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL Software is Complex Systems are big and they do complicated things and they may be distributed and/or concurrent Addressing Complexity Algorithms, data structures,


slide-1
SLIDE 1

The Power of Abstraction

Barbara Liskov March 2013 MIT CSAIL

slide-2
SLIDE 2

Software is Complex

 Systems are big  and they do complicated things  and they may be distributed and/or

concurrent

slide-3
SLIDE 3

Addressing Complexity

 Algorithms, data structures, protocols

slide-4
SLIDE 4

Addressing Complexity

 Algorithms, data structures, protocols  Programming methodology  Programming languages

slide-5
SLIDE 5

This Talk

 Programming methodology as it

developed

 Programming languages  Programming languages today

slide-6
SLIDE 6

The Situation in 1970

 The software crisis!

slide-7
SLIDE 7

Programming Methodology

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

slide-8
SLIDE 8

The Landscape

 E. W. Dijkstra. Go To Statement

Considered Harmful. Cacm, Mar. 1968

slide-9
SLIDE 9

The Landscape

 N. Wirth. Program Development by

Stepwise Refinement. Cacm, April 1971

slide-10
SLIDE 10

The Landscape

 D. L. Parnas. Information Distribution

Aspects of Design Methodology. IFIP Congress, 1971

 “The connections between modules are

the assumptions which the modules make about each other.”

slide-11
SLIDE 11

Modularity

 A program is a collection of modules

slide-12
SLIDE 12

Modularity

 A program is a collection of modules  Each module has an interface,

described by a specification

slide-13
SLIDE 13

Modularity

 A program is a collection of modules  Each has an interface, described by a

specification

 A module’s implementation is correct if it

meets the specification

 A using module depends only on the

specification

slide-14
SLIDE 14

Modularity

 A program is a collection of modules  Each has an interface, described by a

specification

 A module’s implementation is correct if it

meets the specification

 A using module depends only on the

specification

 E.g. a sort routine sort(a)

slide-15
SLIDE 15

Benefits of Modularity

 Local reasoning  Modifiability  Independent development

slide-16
SLIDE 16

The Situation in 1970

 Procedures were the only type of

module

 Not powerful enough, e.g., a file system  Not used very much  Complicated connections

slide-17
SLIDE 17

Partitions

 B. Liskov. A Design Methodology for

Reliable Software Systems. FJCC, Dec. 1972

slide-18
SLIDE 18

Partitions

Partition state

  • p1 op2 op3
slide-19
SLIDE 19

From Partitions to ADTs

 How can these ideas be applied to

building programs?

slide-20
SLIDE 20

Idea

 Connect partitions to data types

slide-21
SLIDE 21

Meeting in Savanah

 ACM Sigplan-Sigops interface meeting.

April 1973. (Sigplan Notices, Sept. 1973)

 Started to work with Steve Zilles

slide-22
SLIDE 22

The Landscape

 Extensible Languages

 S. Schuman and P. Jourrand. Definition

Mechanisms in Extensible Programming

  • Languages. AFIPS. 1970

 R. Balzer. Dataless Programming. AFIPS.

1967

slide-23
SLIDE 23

The Landscape

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

Program Structures. Structured Programming, Academic Press, 1972

slide-24
SLIDE 24

The Landscape

 J. H. Morris. Protection in Programming

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

Abstract Data Types

 B. Liskov and S. Zilles. Programming

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

  • Languages. April 1974
slide-26
SLIDE 26

What that paper proposed

 Abstract data types

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

the objects

 A sketch of a programming language

slide-27
SLIDE 27

From ADTs to CLU

 Participants

 Russ Atkinson  Craig Schaffert  Alan Snyder

slide-28
SLIDE 28
slide-29
SLIDE 29

Why a Programming Language?

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

slide-30
SLIDE 30

Some Facts about CLU

 Static type checking  Heap-based  Separate compilation  No concurrency, no gotos, no

inheritance

slide-31
SLIDE 31

CLU Mechanisms

 Clusters  Polymorphism  Iterators  Exception handling

slide-32
SLIDE 32

Clusters

IntSet = cluster is create, insert, delete, … % representation for IntSet objects % implementation of the operations end IntSet

slide-33
SLIDE 33

Clusters

IntSet = cluster is create, insert, delete, … % representation for IntSet objects % implementation of the operations end IntSet IntSet s = IntSet$create( ) IntSet$insert(s, 3)

slide-34
SLIDE 34

Polymorphism

Set = cluster[T: type] is create, insert, … % representation for Set object % implementation of Set operations end Set Set[int] s := Set[int]$create( ) Set[int]$insert(s, 3)

slide-35
SLIDE 35

Polymorphism

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

slide-36
SLIDE 36

Iterators

 For all x in C do S

slide-37
SLIDE 37

Iterators

 For all x in C do S

 Destroy the collection?  Complicate the abstraction?

slide-38
SLIDE 38

Visit to CMU

 Bill Wulf and Mary Shaw, Alphard  Generators

slide-39
SLIDE 39

Iterators

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

slide-40
SLIDE 40

Also

 Exception handling

 Strong specifications, e.g., IntSet$choose

 First class Procedures and Iterators

slide-41
SLIDE 41

After CLU

 Argus and distributed computing  Programming methodology

 Modular program design  Reasoning about correctness  Type hierarchy

slide-42
SLIDE 42

From CLU to Object-Oriented Programming

 SmallTalk provided inheritance

slide-43
SLIDE 43

The Landscape

 Inheritance was used for:

 Implementation  Type hierarchy

slide-44
SLIDE 44

Type Hierarchy

 Wasn’t well understood

 E.g., stacks vs. queues

slide-45
SLIDE 45

The Liskov Substitution Principle (LSP)

 Objects of subtypes should behave like

those of supertypes if used via supertype methods

 B. Liskov. Data abstraction and

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

What Next?

 Modularity based on abstraction is the

way things are done

slide-47
SLIDE 47

Programming Languages Today

 Languages for experts, e.g., Java, C#

slide-48
SLIDE 48

Programming 1A

 E.g., Python

slide-49
SLIDE 49

Challenges

 A programming language for novices

and experts

 Ease of use vs. expressive power  Readability vs. writeability  Modularity and encapsulation  Powerful abstraction mechanisms  State matters

slide-50
SLIDE 50

Challenges

 Massively-parallel computers

 Programming methodology  Programming language support

slide-51
SLIDE 51

The Power of Abstraction

Barbara Liskov March 2013 MIT CSAIL