History of ObjectOriented Programming Chapter 1 Squeak Objectoriented
History of Object-Oriented Programming Chapter 1 Squeak: Object-oriented design with multimedia applications Copyright 2000, Mark Guzdial
Start of the Story: Late 60's and Early 70's z Windows are made of glass, mice are undesirable rodents z Good programming = Structured programming y. Verb-oriented 9/26/2021 Copyright 2000, Mark Guzdial 2
Structured Programming z Define tasks to be performed z Break tasks into smaller and smaller pieces y. Until you reach an implementable size z Define the data structures to be manipulated z Design how functions interact y. What's the input y. What's the output z Group functions into components ("units" or "classes") z Write the code 9/26/2021 Copyright 2000, Mark Guzdial 3
Object-oriented programming z First goal: Model the objects of the world y. Noun-oriented y. Focus on the domain of the program z Phases y. Object-oriented analysis: Understand the domain x. Define an object-based model of it y. Object-oriented design: Define an implementation x. Design the solution y. Object-oriented programming: Build it 9/26/2021 Copyright 2000, Mark Guzdial 4
How’d we get from there to here? z How did we move from structured to objectoriented? y. Key ideas x. Master-drawings in Sketchpad x. Simulation “objects” in Simula y. Alan Kay and a desire to make software better x. More robust, more maintainable, more scalable 9/26/2021 Copyright 2000, Mark Guzdial 5
Birth of Objects, 1 of 2 z Ivan Sutherland's Sketchpad, 1963 9/26/2021 Copyright 2000, Mark Guzdial 6
Sketchpad z First object-oriented drawing program z Master and instance drawings y. Draw a house y. Make two instances y. Add a chimney to the master y. Poof! The instances grow a chimney z Other interesting features y 1/3 Mile Square Canvas y. Invention of “rubber band” lines y. Simple animations 9/26/2021 Copyright 2000, Mark Guzdial 7
Birth of Objects, 2 of 2 z Simula y. Simulation programming language from Norway, 1966 (Kristen Nygaard & Ole-Johan Dahl) y. Define an activity which can be instantiated as processes y. Each process has it own data and behavior x. In real world, objects don't mess with each others' internals directly y(Simulated) Multi-processing x. No Universal Scheduler in the Real World 9/26/2021 Copyright 2000, Mark Guzdial 8
Alan Kay z U. Utah Ph. D student in 1966 y. Read Sketchpad, Ported Simula z Saw “objects” as the future of computer science z His dissertation: Flex, an object-oriented personal computer y. A personal computer was a radical idea then y. How radical? "There is no reason anyone would want a computer in their home. " (Ken Olsen, Digital Equipment Corp, 1977) 9/26/2021 Copyright 2000, Mark Guzdial 9
Kay’s Insights z “Computer” as collection of Networked Computers z All software is simulating the real world z Biology as model for objects y. Bacterium has 120 M of info, 1/500 th of a Cell, and we have 10^13 of these in us y. What man-made things can scale like that? x. Stick a million dog houses together to get a skyscraper? x. Internet does, but how can we make that the norm? 9/26/2021 Copyright 2000, Mark Guzdial 10
Birth of Objects z Objects as models of real world entities z Objects as Cells y Independent, indivisible, interacting -- in standard ways z Scales well y Complexity: Distributed responsibility y Robustness: Independent y Supporting growth: Same mechanism everywhere y Reuse: Provide services, just like in real world 9/26/2021 Copyright 2000, Mark Guzdial 11
Features of Objects z Encapsulation: Can't mess with the innards z Inheritance: Objects can get structure (data) and behavior (methods) from another z Aggregation: Objects can be created over-and-over and combined within other objects 9/26/2021 Copyright 2000, Mark Guzdial 12
"A Personal Computer for Children of All Ages" z Flex, an object-oriented personal computer 9/26/2021 Copyright 2000, Mark Guzdial 13
Flex z Enabled by Moore's Law y Imagining personal computing in 1969 z Logo, Sketchpad, and Simula y Learning representations and knowledge through programming them y Keyboard and drawing tablet z Computer as meta-medium y The first medium to encompass other media 9/26/2021 Copyright 2000, Mark Guzdial 14
Xerox PARC: Learning Research Group: Smalltalk-72 z Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler 9/26/2021 Copyright 2000, Mark Guzdial 15
Goal: Dynabooks z Small, handheld z Wireless networking z A Personal Computer for Children of All Ages 9/26/2021 Copyright 2000, Mark Guzdial 16
Smalltalk Inventions z WIMP interface y overlapping Windows y Icons, even iconic programming y Pop-up menus y Mouse as Pointing device z Object-oriented programming z Multimedia authoring environment: Drawing, music, animations 9/26/2021 Copyright 2000, Mark Guzdial 17
How Smalltalk was Implemented z Bytecode compiler y Machine language for a make-believe computer z Virtual machine to create the make-believe computer y Invented years earlier by Burroughs y Used in UCSD Pascal, Java, Python, etc. z Four files needed for this implementation: y VM y Image file (in bytecode) y Sources file (all sources always came along) y Changes file (added sources by user) 9/26/2021 Copyright 2000, Mark Guzdial 18
Virtual Machines 9/26/2021 Copyright 2000, Mark Guzdial 19
Tradeoffs of Virtual Machines z Advantages: y Can be easily ported x. If VM is well-designed, small amount of code needs to be written for each platform y The VM can be very small x. Power. Mac 308 K, Win 32 328 K, Linux-Intel 276 K, SGI Irix 609 K, Solaris 816 K y Binary compatibility across platforms z Distadvantages y Hard to make it efficient x. But Moore's law makes efficient-enough easier all the time 9/26/2021 Copyright 2000, Mark Guzdial 20
1981: Xerox releases Smalltalk-80 z To prove portability, sends tapes to IBM, Sun, Apple, HP, Tektronix y Smalltalk research starts up at all these places y Some Tektronix oscilloscopes have Smalltalk inside of them z Spins off Parc. Place to market Smalltalk y Adele Goldberg goes to run the new company y Smalltalk-80 -> Object. Works -> Visual. Works y Parc. Place -> Object. Share + Neometron and then Cincom z Other Smalltalks: Digitalk's Smalltalk/V and Quasar's Smalltalk. Agents 9/26/2021 Copyright 2000, Mark Guzdial 21
Back to the Future: Birth of Squeak z 1995: Alan Kay, Dan Ingalls, Ted Kaehler are all at Apple y Still want "A development environment in which to build educational software that could be used—and even programmed—by non-technical people and by children" y Build on Open Source Software strengths x. Use the distributed power of Internet-based programmers 9/26/2021 Copyright 2000, Mark Guzdial 22
Squeak Team z Include John Maloney, Scott Wallace, and Kim Rose y Maloney from Self: O-O at nearly C speeds y Wallace: End-user programming, programming frameworks y Rose: Education practice and study z Wanted a new Smalltalk, but didn't have to build from scratch y Apple had the original Smalltalk-80 still! 9/26/2021 Copyright 2000, Mark Guzdial 23
"Build everything in Smalltalk" y "We determined that implementation in C would be key to portability but none of us wanted to write in C. " z. Make the Apple Smalltalk portable again z. Write a new VM all in Smalltalk z. Write a Smalltalk-to-C translator z. Spit out the new VM on the new Smalltalk z. Whole process: 16 weeks 9/26/2021 Copyright 2000, Mark Guzdial 24
Squeak z Even from the beginning, powerful implementation y 16 voice music synthesis, all in Smalltalk z Released to the net, and ported to Windows and UNIX within five weeks y Apple license allows commercial apps, but system fixes must be posted z Squeak Team moves to Disney y In the end, it's about media. z Squeak today y Media: 3 -D graphics, MIDI, Flash, sound recording y Network: Web, POP/SMTP, zip compression/decompress y Beyond Smalltalk-80: Exceptions, namespaces 9/26/2021 Copyright 2000, Mark Guzdial 25
Squeak for CS Education z Everything is written in Smalltalk! 9/26/2021 Copyright 2000, Mark Guzdial 26
Common Ancestry of Other O-O Languages z C++ y. Bjarne Stroustrup wanted highly-efficient Simula y. At Bell Labs, developed C-With-Classes x. In 1984, C++ was born z Java y 1991, Sun starts project to produce a language for embedded computing x. James Gosling's Oak y. On the Web, every client looks like a different kind of programmable toaster oven y. In 1995, Oak became Java 9/26/2021 Copyright 2000, Mark Guzdial 27
C++ compared to Smalltalk z C++ is… y Mixed paradigm programming: Objects, but can have functions, too y Compiled to native code (Recall: Main goal is efficiency) y Based on traditional functions and stack-based scoping y Strongly typed y Storage is controlled by the programmer z Smalltalk is… y Dynamic (feels like an interpreter) y Byte-code compiled y Persistent objects y Not at all typed y Garbage collection: Storage is managed by the system 9/26/2021 Copyright 2000, Mark Guzdial 28
Java compared to the others z Java looks like C++, but… y Mostly objects (no functions, but some primitive types) y Uses a VM y Objects are more like C++'s than Smalltalks y Even more strongly typed y Storage is handled by garbage collection 9/26/2021 Copyright 2000, Mark Guzdial 29
- Slides: 29