1 / 12

Introduction to Smalltalk

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

cheever
Download Presentation

Introduction to Smalltalk

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. C++ Historical Background Lisp Algol 60 1960 Simula 67 1970 Smalltalk-72 Pascal Smalltalk-74 Smalltalk-76 C Flavors Smalltalk-78 LOOPS 1980 Smalltalk-80 Common Lisp Clascal Ada C86 Common Loops New Flavors Object Pascal C with classes Little Smalltalk Quick Pascal Turbo Pascal CLOS 1990 Squeak ANSI C++

  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. 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. Squeak in Our Course • Squeak installed on: • SSDL Lab • Can be downloaded from: • 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. Why Squeak? • Pure object-oriented language and environment • “Everything is an object” • Language and environment • Class browser, debugger, inspector, … • Mature class library and tools • Virtual machine • Objects exist in a persistent image [+ changes] • Portable: Compile once, run everywhere • Open-source, implemented in Smalltalk • Based on original Smalltalk-80 code

  7. Squeak by Example • www.SqueakByExample.org • Free PDF download

  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 argument2. 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 classSmallInteger. Each object is an instance of a class.

  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. 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. Bon • Business Object Notation • AKA: Better Object Notation • Inventors: • Jean-Marc Nerson and Kim Walden (1995) • Legend (partial) Class Object AbstractClass* Inheritance

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

More Related