advertisement

2008 Sccc Smalltalk

61 %
39 %
advertisement
Information about 2008 Sccc Smalltalk
Education

Published on November 13, 2008

Author: bergel

Source: slideshare.net

Description

After a short introduction to object orientation, this lecture gives an overview of the Smalltalk programming language.
This lecture was given on November 10, 2008, during the summer school on programming languages (http://pleiad.dcc.uchile.cl/pl2008/)
advertisement

Object-oriented !quot;#$ programming in Smalltalk Alexandre Bergel RMoD team, INRIA, Lille, France alexandre@bergel.eu

Goal of this lecture • Gain elementary notions of object orientation • Learn what is a pure object oriented language • Increase the programming language section on your CV

Outline 1. Essence of class-based object orientation 2. Object oriented programming with Smalltalk 3. Smalltalk in Action

Outline 1. Essence of class-based object orientation 2. Object oriented programming with Smalltalk 3. Smalltalk in Action

Procedural programming color = data shape = behavior (Flatt 98)

Procedural programming (Flatt 98)

Expressing combination

Example in C struct Point { struct Circle { const void * class; const void * class; int x, y; int x, y, rad; }; }; void draw (void * self) { void move (void * self) { switch(self[0]) { switch(self[0]) { case POINT_CLASS: ... case POINT_CLASS: ... case CIRCLE_CLASS: ... case CIRCLE_CLASS: ... } } } } !quot;#$

Expressing extension

Expressing extension

Situation with some difficulties

Object-oriented programming • Simula 67 addressed the combinational explosion of data and behavior • a class is an object factory • class = superclass + attributes + methods • object reactive to messages

Object as programming entities a student printDescription() name=Bill courses={c1, c2}

Object as programming entities ^ 'My name is ', Person name age gender description() Transcript show: printDescription() self description a student Student printDescription() name=Bill instance courses super description, courses={c1, c2} description() ' and I follows ', courses

Object as programming entities ^ 'My name is ', Person name age gender description() Transcript show: printDescription() self description a student 1 Student printDescription() name=Bill instance courses super description, courses={c1, c2} description() ' and I follows ', courses

Object as programming entities ^ 'My name is ', Person name age gender description() Transcript show: printDescription() self description a student 1 Student description() name=Bill instance courses super description, courses={c1, c2} description() ' and I follows ', courses 2

Object as programming entities 3 ^ 'My name is ', Person name age gender description() Transcript show: printDescription() self description a student 1 Student super name=Bill instance courses super description, description() courses={c1, c2} description() ' and I follows ', courses 2

Object as programming entities 3 ^ 'My name is ', Person name age gender description() Transcript show: printDescription() self description a student 1 Student super name=Bill instance courses super description, description() courses={c1, c2} description() ' and I follows ', courses 2

Object-oriented programming Encapsulation Abstraction & Information Hiding Composition Nested Objects Distribution of Separation of concerns (e.g., HTML, CSS) Responsibility Message Passing Delegating responsibility Conceptual hierarchy, Inheritance polymorphism and reuse

Outline 1. Essence of class-based object orientation 2. Object oriented programming with Smalltalk 3. Smalltalk in Action

Smalltalk

The origin of Smalltalk Alan Kay’s Dynabook project (1968) Alto — Xerox PARC (1973)

Smalltalk today

Smalltalk today

Smalltalk today

Smalltalk today

Smalltalk today

Squeak resources www.squeak.org www.seaside.st Downloads and links One-click image SqueakByExample.org Free download — Print-on-demand

Getting started

Everything is an object

Everything happens by sending messages

Running Squeak

Do it, print it You can evaluate any expression anywhere in Smalltalk

Standard development tools

Debuggers, Inspectors, Explorers

Syntax in a Nutshell

Three kind of messages 5 factorial Unary messages Transcript cr Binary messages 3 + 4 Keyword messages 3 raisedTo: 10 modulo: 5 Transcript show: 'hello world'

A typical method in the class Point Method name Argument Comment <= aPoint quot;Answer whether the receiver is neither below nor to the right of aPoint.quot; ^ x <= aPoint x and: [y <= aPoint y] Return Binary message Block Instance variable Keyword message (2@3) <= (5@6) true

Statements and cascades Temporary variables Statement | p pen | p := 100@100. pen := Pen new. pen up. pen goto: p; down; goto: p+p Cascade

Control structures Every control structure is realized by message sends 4 timesRepeat: [Beeper beep] max: aNumber ^ self < aNumber ifTrue: [aNumber] ifFalse: [self]

Control structures Every control structure is realized by message sends 4 timesRepeat: [Beeper beep] Boolean ifTrue:ifFalse: max: aNumber True False ^ self < aNumber ifTrue:ifFalse: ifTrue:ifFalse: ifTrue: [aNumber] ifFalse: [self] ifTrue: t ifFalse: f ifTrue: t ifFalse: f ^ t value ^ f value

Creating classes Send a message to a class (!) Number subclass: #Complex instanceVariableNames: 'real imaginary' classVariableNames: '' poolDictionaries: '' category: 'ComplexNumbers'

Outline 1. Essence of class-based object orientation 2. Object oriented programming with Smalltalk 3. Smalltalk in Action

#complex presentations

Add a comment

Related presentations

Related pages

2008 Sccc Smalltalk - Education - documents.mx

After a short introduction to object orientation, this lecture gives an overview of the Smalltalk programming language. This lecture was given on November ...
Read more

Alexandre Bergel

2008 Sccc Smalltalk. View SlideShare presentation or Upload your own. (tags: oriented object) Retrospective on traits Traits are a simple composition ...
Read more

Marketing Smalltalk - Technology - documents.mx

Marketing Smalltalk – Business and Community Marketing, Monika Laurent. (ESUG 2004, Koethen) ... 2008 Sccc Smalltalk. Login or Join. Processing
Read more

CiteULike: leonardo's 2008 [at least 200 articles]

leonardo's 2008 [at least 200 articles] ... Ducasse, and Arévalo for a Smalltalk setting, ... 2008. SCCC '08.
Read more

dblp: Kim Mens

SCCC 2008: 100-109 [c31] view. electronic edition via DOI; ... http://dblp.org/rec/conf/smalltalk/BrichauKGMHD06; Johan Brichau, Andy Kellens, Kris Gybels, ...
Read more

dblp: Alexandre Bergel

List of computer science publications by Alexandre Bergel. ... the case of Smalltalk. DLS 2014: 135-146 ... ERCIM News 2008 (72) (2008) 2007 [j5] view.
Read more

Open Unification for Program Query Languages

Official Full-Text Publication: Open Unification for Program Query Languages on ResearchGate, the professional network for scientists.
Read more

Westerlands News

... I realise that my face is covered in slabbers and when grimacing I look like Quasimodo, but they certainly weren't into smalltalk! ...
Read more