is a good choice for a teaching object-oriented programming ° Every one requires that students spend more time mastering the language than learning the fundamentals of object-orientation. • For novices, the “inessential” or “accidental” difficulty of the language often dominates the “essential” difficulty of programming 2
Kim. B. Bruce, James Noble and Michael Homer The complexity of software is an essential property, not an accidental one Fred Brooks, 1986 Grace is the absence of everything that indicates pain or difficulty, hesitation or incongruity. Wi!iam Hazlitt, 1817
into a simple, general-purpose teaching language whose features represent the key concepts of object oriented-programming directly, simply and gracefu!y 4
° small number of concepts to learn ° each concept has power to “explain” a lot about the language • But not a toy ° Extensible through libraries • Looking towards distributed and parallel implementation ° Support immutable objects 5
// reads numbers from this stream and averages { var total := 0 var count := 0 until {atEnd} do { count := count + 1 total := total + readNumber } if (count = 0) then {return 0} total / count } 6 Might appear in a stream object implicit self. implicit self. until()do() is a method Е- Е- nested scope
design! ° accessible to instructors, most of whom are not programming language buffs • The Onward! paper focusses on 1. Constructing objects 2. Types 3. “Language Levels” 4. Implementation 7
from? • Prototypes of basic objects are present ab initio • What about user defined objects? ° start with a basic object and mutate it by adding fields and methods 㱺 all objects are mutable not “mainstream”
constructor: set.map { each -> ! object { ! ! def name is readable, public = each.first ! ! def address is readable, public = each.second ! ! method email is public { ! ! ! EmailApp.openComposerWindowTo(name) ! ! } ! } } 15 internal iterator method λ-expression name initialized using each, from surrounding lexical scope each is parameter
an object: def anAddressCard = object { ! method for (aName) at (anAddress) { ! ! object { ! ! ! def name is readable, public = aName ! ! ! def address is readable, public = anAddress ! ! ! method email is public { ! ! ! ! EmailApp.openComposerWindowTo(name) ! ! ! } ! ! } ! } } 16 Factory Object name is initialized to parameter of factory method factory method is called for()at() factory object, has a single method
its factory method, and the fields and methods of the objects that it creates class anAddressCard.for (aName) at (anAddress) { !! ! ! def name is readable, public = aName ! ! def address is readable, public = anAddress ! ! method email is public { ! ! ! EmailApp.openComposerWindowTo(name) ! ! } } 17 Factory Object = Class
superobject ° given in the object constructor ° must be newly-created, and manifest ° fields and methods of the superobject are inherited by its heir • Note that the fields of the superobject are already initialized 18