smalltalk for unix & w i n d o w s dennis smith cherniak software development corporation
TRANSCRIPT
![Page 1: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/1.jpg)
Smalltalkfor
Unix & Windows
Dennis Smith
Cherniak Software Development Corporation
![Page 2: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/2.jpg)
Smalltalk
• Smalltalk is …– a computer language
– a development environment
– a philosophy of development
– 100% objects
![Page 3: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/3.jpg)
Where did it come from
• Conceived in the late 1960’s by Alan Kay
• Ideas from Simula, Logo, SketchPad• Concept of communicating “cells”
from his biology background• “Cells” later became “Objects”
• Alan Kay Moved to Xerox Park in 1972 where he worked on Smalltalk as a language for teaching children
![Page 4: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/4.jpg)
Alan Kay
• Developed a number of concepts in the 60’s and 70’s– Objects– GUI interfaces– LapTop Computer– Smalltalk
• Alan Kay is now a “Disney Fellow” doing general Research
![Page 5: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/5.jpg)
Smalltalk Yesterday & Today
• First commercial use– Tektronix, embedded in
oscilloscopes
• Used in many areas today– U.S. Power and Light utilities– Insurance Industry– Volkswagen production line– Swiss banks– Ford, General Motors, Chrysler
(Xtreme Programming)– Active Web Sites
![Page 6: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/6.jpg)
Implementations
• VisualWorks (CINCOM) – Based on Xerox Park work– Binary cross-platform (UNIX,
Linux, Windows, Mac)– Full NC version at
www.cincom.com
• ObjectStudio (CINCOM)– Windows & Mainframes
• IBM VisualAge Smalltalk– Cross-platform via source (UNIX,
Windows, OS/2)
![Page 7: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/7.jpg)
Implementations (2)
• Gemstone/S (Gemstone)– server side, persistent, multi-user, active
ODBMS (Unix, Linux, Windows)
– NC versions available at www.gemstone.com
• Dolphin– was free now commercial
• Squeak– Free - small group started by Alan Kay– Available at www.squeak.org
• MT– compiled, windows-only
• GNU– command line, no GUI
![Page 8: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/8.jpg)
Smalltalk – What Is It
• A pure object language
• Simple syntax (5 lines of BNF)
• No compile-time types– Object’s have types– Variables / parameters do not
• Syntax contains no conditionals
• Syntax contains no loops
• Automatic Garbage Collection
![Page 9: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/9.jpg)
Smalltalk – What is it (2)
• Uses a VM
• Compiles to byte codes
• Byte codes can be interpreted
• Normal execution uses a “cached compile” technique pioneered by Smalltalk in the 1980’s.
• Debugging uses interpreter
![Page 10: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/10.jpg)
The Language
• Data is encapsulated in objects
• Access via sending message to the object
• A message invokes a method
• All method returns a value (default the object)
• Everything is an object– Integer, Float, Character, String– Class, Method, Byte Codes– Other Objects
![Page 11: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/11.jpg)
Classes, Variables, Objects
• A class is a pattern for an object– Defines instance variables
– Defines methods
– May inherit from another class
• An Object is instantiated from a class using “Class new”
• Two kinds of variables– Instance variables in the object
– Temporary variables in the method
![Page 12: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/12.jpg)
Methods and Messages
• Three kinds of messages– Unary (name of method)
• person surname
– Keyword (name and parameters)• person surname: ‘Jones’
– Binary, any single or pair of special characters
• personA = personB
• stringA , stringB
• age + 4
• age + 4 * 2
![Page 13: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/13.jpg)
Constant Values
• Constants– Integers 2, 248– Characters $A $+ $$– Strings ‘this is a string’– Floats 123.45– Fixed Decimal (some) 123.45s– Symbols (canonicalized strings)
#abc #surname– Arrays #(12 ‘string’)
• Comments– “this is a comment”
![Page 14: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/14.jpg)
Arithmetic
• This slide should be empty, there is no such concept
• However, by convention, if you send the message “+” to a numeric value the result is likely the sum
• Note however that “+” could be defined for String, Person etc.
• Note “3 + 4 * 5” results in 35!!
![Page 15: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/15.jpg)
Conditionals
• Code block (its an object)[statements][:parm | statements]
• ConditionalaBoolean ifTrue: […]aBoolean ifTrue: […] ifFalse: […]
(true) ifTrue: aBlockaBlock value
(false) ifTrue: aBlock“do nothing”
![Page 16: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/16.jpg)
Collections
• Many types of collections– Array (fixed size)– OrderedCollection (variable size)– Dictionary (keyed values)
• Simple enumeratoraCollection do: [:obj | …]
• Other enumeratorsselect:block returns boolean
reject:block returns boolean
collect: block returns new values
![Page 17: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/17.jpg)
Sample Code
(PersonHolder)firstPerson
| person |person := self getPerson.spouse := person spouse.spouse > person ifTrue: [^spouse].^person
(Person)> aPerson
^self age > aPerson age
![Page 18: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/18.jpg)
Sample Code (2)
• Find all persons older than some other person:
allOlderThan: aPerson
^personList select: [:p | p > aPerson]
![Page 19: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/19.jpg)
Why Smalltalk
• Its fast
• Its easy to work and think with
• Changes are instantly available
• Debugger is fully interactive
• Its fully reflective, classes, methods, byte codes, compiler all written in Smalltalk
• Automatic garbage collection
![Page 20: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/20.jpg)
Why Smalltalk (2)
• Features– IDE uses single browser (written
in Smalltalk of course)– Fully integrated GUI
development– Image reading (gif, bmp) and
manipulation (grow, shrink, rotate, flip, …)
– Network Support (SMTP, POP, IMAO, SOAP, SSP (JSP), …)
![Page 21: Smalltalk for Unix & W i n d o w s Dennis Smith Cherniak Software Development Corporation](https://reader030.vdocuments.mx/reader030/viewer/2022033108/56649edc5503460f94bed17c/html5/thumbnails/21.jpg)
What We doat Cherniak Software
• Tools and Framework for building end-user database applications– Accounting– Payroll– Custom
• VisualWorks and Gemstone
• Business and Framework code runs both on VW and on Gemstone