The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March...
Transcript of The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March...
![Page 1: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/1.jpg)
The Power of Abstraction
Barbara Liskov
March 2013
MIT CSAIL
![Page 2: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/2.jpg)
Software is Complex
Systems are big
and they do complicated things
and they may be distributed and/or concurrent
![Page 3: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/3.jpg)
Addressing Complexity
Algorithms, data structures, protocols
![Page 4: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/4.jpg)
Addressing Complexity
Algorithms, data structures, protocols
Programming methodology
Programming languages
![Page 5: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/5.jpg)
This Talk
Programming methodology as it developed
Programming languages
Programming languages today
![Page 6: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/6.jpg)
The Situation in 1970
The software crisis!
![Page 7: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/7.jpg)
Programming Methodology
How should programs be designed?
How should programs be structured?
![Page 8: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/8.jpg)
The Landscape
E. W. Dijkstra. Go To Statement Considered Harmful. Cacm, Mar. 1968
![Page 9: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/9.jpg)
The Landscape
N. Wirth. Program Development by Stepwise Refinement. Cacm, April 1971
![Page 10: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/10.jpg)
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.”
![Page 11: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/11.jpg)
Modularity
A program is a collection of modules
![Page 12: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/12.jpg)
Modularity
A program is a collection of modules
Each module has an interface, described by a specification
![Page 13: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/13.jpg)
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
![Page 14: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/14.jpg)
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)
![Page 15: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/15.jpg)
Benefits of Modularity
Local reasoning
Modifiability
Independent development
![Page 16: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/16.jpg)
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
![Page 17: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/17.jpg)
Partitions
B. Liskov. A Design Methodology for Reliable Software Systems. FJCC, Dec. 1972
![Page 18: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/18.jpg)
Partitions
Partition state
op1 op2 op3
![Page 19: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/19.jpg)
From Partitions to ADTs
How can these ideas be applied to building programs?
![Page 20: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/20.jpg)
Idea
Connect partitions to data types
![Page 21: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/21.jpg)
Meeting in Savanah
ACM Sigplan-Sigops interface meeting. April 1973. (Sigplan Notices, Sept. 1973)
Started to work with Steve Zilles
![Page 22: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/22.jpg)
The Landscape
Extensible Languages
S. Schuman and P. Jourrand. Definition Mechanisms in Extensible Programming Languages. AFIPS. 1970
R. Balzer. Dataless Programming. AFIPS. 1967
![Page 23: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/23.jpg)
The Landscape
O-J. Dahl and C.A.R. Hoare. Hierarchical Program Structures. Structured Programming, Academic Press, 1972
![Page 24: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/24.jpg)
The Landscape
J. H. Morris. Protection in Programming Languages. Cacm. Jan. 1973
![Page 25: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/25.jpg)
Abstract Data Types
B. Liskov and S. Zilles. Programming with Abstract Data Types. ACM Sigplan Conference on Very High Level Languages. April 1974
![Page 26: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/26.jpg)
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
![Page 27: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/27.jpg)
From ADTs to CLU
Participants
Russ Atkinson
Craig Schaffert
Alan Snyder
![Page 28: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/28.jpg)
![Page 29: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/29.jpg)
Why a Programming Language?
Communicating to programmers
Do ADTs work in practice?
Getting a precise definition
Achieving reasonable performance
![Page 30: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/30.jpg)
Some Facts about CLU
Static type checking
Heap-based
Separate compilation
No concurrency, no gotos, no inheritance
![Page 31: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/31.jpg)
CLU Mechanisms
Clusters
Polymorphism
Iterators
Exception handling
![Page 32: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/32.jpg)
Clusters
IntSet = cluster is create, insert, delete, … % representation for IntSet objects % implementation of the operations end IntSet
![Page 33: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/33.jpg)
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)
![Page 34: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/34.jpg)
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)
![Page 35: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/35.jpg)
Polymorphism
Set = cluster[T: type] is create, insert, …
where T has equal: proctype(T, T)
returns (bool)
![Page 36: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/36.jpg)
Iterators
For all x in C do S
![Page 37: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/37.jpg)
Iterators
For all x in C do S
Destroy the collection?
Complicate the abstraction?
![Page 38: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/38.jpg)
Visit to CMU
Bill Wulf and Mary Shaw, Alphard
Generators
![Page 39: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/39.jpg)
Iterators
sum: int := 0
for e: int in Set[int]$members(s) do
sum := sum + e
end
![Page 40: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/40.jpg)
Also
Exception handling
Strong specifications, e.g., IntSet$choose
First class Procedures and Iterators
![Page 41: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/41.jpg)
After CLU
Argus and distributed computing
Programming methodology
Modular program design
Reasoning about correctness
Type hierarchy
![Page 42: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/42.jpg)
From CLU to Object-Oriented Programming
SmallTalk provided inheritance
![Page 43: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/43.jpg)
The Landscape
Inheritance was used for:
Implementation
Type hierarchy
![Page 44: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/44.jpg)
Type Hierarchy
Wasn’t well understood
E.g., stacks vs. queues
![Page 45: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/45.jpg)
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
![Page 46: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/46.jpg)
What Next?
Modularity based on abstraction is the way things are done
![Page 47: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/47.jpg)
Programming Languages Today
Languages for experts, e.g., Java, C#
![Page 48: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/48.jpg)
Programming 1A
E.g., Python
![Page 49: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/49.jpg)
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
![Page 50: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/50.jpg)
Challenges
Massively-parallel computers
Programming methodology
Programming language support
![Page 51: The Power of Abstraction - qconlondon.com€¦ · The Power of Abstraction Barbara Liskov March 2013 MIT CSAIL . Software is Complex ...](https://reader035.fdocuments.net/reader035/viewer/2022081616/600359a93132143e79337718/html5/thumbnails/51.jpg)
The Power of Abstraction
Barbara Liskov
March 2013
MIT CSAIL