Presentation is loading. Please wait.

Presentation is loading. Please wait.

Self: The Power of Simplicity David Ungar and Randall B. Smith Presenter: Jonathan Aldrich 15-819.

Similar presentations


Presentation on theme: "Self: The Power of Simplicity David Ungar and Randall B. Smith Presenter: Jonathan Aldrich 15-819."— Presentation transcript:

1 Self: The Power of Simplicity David Ungar and Randall B. Smith Presenter: Jonathan Aldrich 15-819

2 History: Smalltalk First “modern” OO language – Alan Kay, 1970s –Everything is an object (e.g., the number 15, the class List) –Garbage collection –Closures Exploratory programming –Designed for kids –Dynamically typed –Add new code/evaluate exprs with no compilation required Extraordinary development environment –10-20 years ago, better than the best IDE today Try it (Squeak)

3 Self’s Simplicity No classes (clone objects instead) No variables (use messages) No control structures (use polymorphism) Everything is an object

4 Classes vs. Prototypes Classes –Hold behavior –Inherit from another class –Can be instantiated Objects –Hold state –Are an instance of a class Prototypes –Hold behavior –Delegate (inherit) to another object –Can be cloned –Hold state

5 Classes vs. Prototypes

6 Instantiation vs. Cloning

7 Self Flexibility

8 Control Structures

9 Modeling closures Just prototype objects –Cloned when closure is invoked –Slots for local variables –parent pointer refers to enclosing environment For closures, just the enclosing method For methods, set to receiver object

10 Closures

11 Multiple Inheritance

12 Code Example

13 Expressiveness Examples in paper –Sharing state between objects –Singleton objects –Easily replace variable with method Run-time behavior changes –Add/remove methods –Dynamic Inheritance: Add/remove/change parent links

14 Dynamic Inheritance Example ReactorController parent* … NormalController operate = { … if (badness) parent*: SafetyController … } SafetyController restart = { … if (safe condition) parent*: NormalController … }

15 Checking Dynamically typed –Errors are caught at run time This slide is largely a placeholder –Will be important part of discussion in other papers

16 Claimed Engineering Benefits (in addition to expressiveness) Concreteness of prototypes Simplicity of cloning [Eliminates infinite meta-regress of Smalltalk]

17 Engineering Challenges Are classes too useful to programmers to give up? Difficulty of reasoning about dynamism Typechecking [Andi’s research]

18 Secret Agenda Development of new language: Plaid –Prototype-based Unifies objects, classes, modules –Type-safe dynamic inheritance –Other features Multi-methods, aspects, typestate, ownership Emphasis: safe component-based SE


Download ppt "Self: The Power of Simplicity David Ungar and Randall B. Smith Presenter: Jonathan Aldrich 15-819."

Similar presentations


Ads by Google