Smalltalk and pure object oriented programming
OO Focuses on the Data
Pure Object-Orientation:Everything is an object
More about objects
What is a class?
Classes are also objects!
Example
Diagram of Ball classand its instances
Everything is an object!
is-instance-of relationship
is-a relationship
Object hierarchy
Computation viamessages and methods
Object-oriented vs.procedural terminology
Smalltalk-80
Features of Smalltalk-80
Smalltalk Class Browser
Class Hierarchy PaneThe Class Hierarchy Navigator
Variables PaneA Filter for the Methods Pane
Methods PaneA Listing of the Relevant Methods
MethodDefinition Window
So where’s my program?
Filing out your code
Filing in code
Asking questions about code
Learning more aboutSmalltalk/Express Environment
Simple Smalltalk Syntax
More Smalltalk Syntax
Stack ObjectImplementing a Stack ADT
Stack Object Methods
Adding a subclass
Adding a class method
Adding an instance method
More stack methods
Shared Variables
Private variables
Variables
Constructing a Stack
Object constructionin Smalltalk
Initializer method
Common mistakes
Errors…
Superb Debugger!
Message terminology
Three kinds of Messages
Parsing Messages
Parsing keyword messages
The importance of the colon:
Cascading messages
Message dispatch
Dispatch examples
Method terminology
Dispatch algorithm
Talking to yourself
Smalltalk schizophrenia
Writing draw withoutmessage dispatch
So what’s the big deal?
Modularity
Overriding a method
Replacing a method
A less drasticchange in behaviour
Do not duplicate code!
Getting help from your parent
super keyword
Example of super
Sample message sends
A small change
More message sends
Recursion
Conditionals
Blocks ? Scheme’s lambda
Blocks package up code
Class Boolean
Class Boolean has no state!
While loops
Common mistakes
Collection classes
Collections understand lots of messages...
do: and collect: messages
Dictionary class
The Smalltalk object
Smalltalk summary