Presentation is loading. Please wait.

Presentation is loading. Please wait.

3A-1 1 Introduction to Smalltalk History of Smalltalk The philosophy of Smalltalk:  “...we have a universe of well-behaved objects that courteously ask.

Similar presentations


Presentation on theme: "3A-1 1 Introduction to Smalltalk History of Smalltalk The philosophy of Smalltalk:  “...we have a universe of well-behaved objects that courteously ask."— Presentation transcript:

1 3A-1 1 Introduction to Smalltalk History of Smalltalk The philosophy of Smalltalk:  “...we have a universe of well-behaved objects that courteously ask each other to carry out their various desires. ” Dan Ingalls, Byte ‘ 81. Basic notions:  Class and instance  Message and method Some Smalltalk programs The class library Objectives:  To mentally prepare for the next lecture...  Read Smalltalk.  To be able to write Smalltalk code.

2 3A-2 2 Historical Background Simula 67 Pascal C CLOS New Flavors Flavors Common Loops Object Pascal Quick PascalTurbo Pascal C++ C with classes C86Ada Little Smalltalk 1990 1980 1970 1960 Algol 60 Lisp Smalltalk-72 Smalltalk-74 Smalltalk-76 Smalltalk-80 Smalltalk-78 Common Lisp LOOPS Clascal ANSI C++ Squeak

3 3A-3 3 Smalltalk History Developed at the Xerox Palo Alto Research Center (Xerox PARC):  Smalltalk-72  Smalltalk-76  Smalltalk-80 Originally intended for children. Ideas from:  Simula-67  Lisp  Logo Xerox pioneer ideas fumbled by the company:  Smalltalk  GUI  PostScript

4 3A-4 4 Smalltalk Versions Smalltalk-80: product of ParcPlace. UNIX, Mac, MS-DOS.  ObjectWorks  VisualWorks Smalltalk/V: product of Digitalk. MS-DOS, Windows, OS/2, Mac. Gnu Smalltalk: X based GUI. Compatible with Smalltalk- 80. Still under development. UNIX. Free. VisualAge : product of IBM. OS/2, Windows. Squeak  Started at Apple, continued at Walt Disney Imagineering  Derived directly from Smalltalk-80  Free, open source  Goals:  Portable  Written in Smalltalk

5 3A-5 5 Squeak in Our Course Squeak installed on:  SSDL Lab  Can be downloaded from:  http://www.squeak.org/ http://www.squeak.org/ Versions:  Windows  Linux Read all about it in the Assignment Yes, it is legal to download it and work at home! No, we will not give technical support for those who wish to work at home!

6 3A-6 Why Squeak? u Pure object-oriented language and environment l “Everything is an object” u Language and environment l Class browser, debugger, inspector, … l Mature class library and tools u Virtual machine l Objects exist in a persistent image [+ changes] l Portable: Compile once, run everywhere u Open-source, implemented in Smalltalk l Based on original Smalltalk-80 code 6

7 3A-7 Squeak by Example u www.SqueakByExample.org l Free PDF download 7

8 3A-8 8 A Question What is the result of the Smalltalk expression:  1 + 2 * 3 Answer: 9 ( Why?!? ) In Smalltalk, 1 is an object. We sent it a message with selector + and argument 2. The response to this message is the object 3. Then, 3 receives the message * with argument 3 and responds 9. The objects 1, 2 and 3 know how to respond to messages like + and *, since they are all integer numbers. In Smalltalk, we say that 1, 2 and 3 are instances of the class SmallInteger. Each object is an instance of a class.

9 3A-9 9 In Smalltalk, everything is an object There is no way to create an entity that is not an object. Every object contains a small amount of memory == instance variables.  Only the object can access its memory.  An object ’ s memory can contain only other objects. Computation: send messages to objects. Objects have methods: what to do when messages are received. Each object is a member of exactly one class. Classes are organized in an inheritance tree.  Multiple inheritance only in very specialised versions.

10 3A-10 Class Library Smalltalk core is:  simple  minimal syntax The language lives and dies by its class library. Different in every implementation and in every version. Almost always includes:  Boolean  Numbers: integers, floating,...  Strings  Collections: sets, bags, arrays, lists, search tables...  (User interface) Can be subclassed by user.

11 3A-11 Bon Business Object Notation AKA: Better Object Notation Inventors:  Jean-Marc Nerson and Kim Walden (1995) Legend (partial) Abstract Class* Class Object Inheritance

12 3A-12 Squeak Class Library ArrayedCollection* Collection* Boolean* False false True true Character Object* Magnitude* Number* Integer Float Set Dictionary Sequenceable Collection* Array String This is only a partial view ProtoObject*


Download ppt "3A-1 1 Introduction to Smalltalk History of Smalltalk The philosophy of Smalltalk:  “...we have a universe of well-behaved objects that courteously ask."

Similar presentations


Ads by Google