DOC PREVIEW
UW CSE 341 - LECTURE NOTES

This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

'&$%CSE 341:Programming LanguagesWinter 2006Lecture 20— Introduction to SmalltalkCSE341 Winter 2006, Lecture 20 1'&$%TodayWhy Smalltalk?Some basics of smalltalk programs• Syntax• Messages• Blocks• Classes and Methods• Dynamic Dispatch• self and superSection: The Squeak environment (projects, saving your work, etc.)CSE341 Winter 2006, Lecture 20 2'&$%Smalltalk• Pure object-oriented• Class-based• Dynamically typedA good starting point for disc ussing what each of these means andwhat other languages look like.The language has been quite stable since 1980.Other points:• A tiny language; easy to learn almost all of it• A complete commitment to dynamic changes; little abstractionsupportCSE341 Winter 2006, Lecture 20 3'&$%Overview of Smalltalk1. All values are objects• Even numbers, code, and classes2. Objects communicate via messages (handled by methods)3. Objects have their own state4. Every object is an instance of a class5. A class provides behavior for its instancesThis sounds a lot like Java, but smaller.It’s also much more like Scheme than it seems; we’ll return to “whatreally makes something OO”But first we need to get “the feel for Smalltalk”CSE341 Winter 2006, Lecture 20 4'&$%Syntaxexp ::= atom | assign| unarySend | infixSend | keywordSend| ( exp ) | exp . exp | ^ expatom ::= ID | literal | blockliteral ::= INTEGER | STRING | ...block ::= [:ID1 ... :IDn | exp] | [ exp ]assign ::= name := exp | name _ expunarySend ::= exp IDinfixSend ::= exp OPERATOR expkeywordSend ::= exp ID1: exp ... IDn: expCSE341 Winter 2006, Lecture 20 5'&$%Some key ideas• Really, everything is an object• Blocks are lambdas• Return (↑) is special• Everything is “dynamic” – evaluation can add/remove classes,add/remove methods, etc.• Dynamic typing• Dynamic dispatch• Sends to self (a special identifier; Java’s this)CSE341 Winter 2006, Lecture 20 6'&$%Protection?• Fields are inaccessible outside of instance• All classes and methods are available to everyone• No namespace management; category has no semantic significanceCSE341 Winter 2006, Lecture 20


View Full Document

UW CSE 341 - LECTURE NOTES

Documents in this Course
Macros

Macros

6 pages

Macros

Macros

6 pages

Macros

Macros

3 pages

Mutation

Mutation

10 pages

Macros

Macros

17 pages

Racket

Racket

25 pages

Scheme

Scheme

9 pages

Macros

Macros

6 pages

Load more
Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?