Smalltalk and pure object oriented programming

8/4/99


Click here to start


Table of Contents

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 class and its instances

Everything is an object!

is-instance-of relationship

is-a relationship

Object hierarchy

Computation via messages and methods

Object-oriented vs. procedural terminology

Smalltalk-80

Features of Smalltalk-80

Smalltalk Class Browser

Class Hierarchy Pane The Class Hierarchy Navigator

Variables Pane A Filter for the Methods Pane

Methods Pane A Listing of the Relevant Methods

Method Definition Window

So where’s my program?

Filing out your code

Filing in code

Asking questions about code

Learning more about Smalltalk/Express Environment

Simple Smalltalk Syntax

More Smalltalk Syntax

Stack Object Implementing 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 construction in 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 without message dispatch

So what’s the big deal?

Modularity

Overriding a method

Replacing a method

A less drastic change 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

Author: Greg J. Badros

Email: badros@cs.washington.edu

Home Page: http://www.cs.washington.edu/education/courses/341/CurrentQtr