8 - OOP - Smalltalk Model
-
Upload
the-world-of-smalltalk -
Category
Education
-
view
989 -
download
2
description
Transcript of 8 - OOP - Smalltalk Model
![Page 1: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/1.jpg)
Stéphane Ducasse 1
Stéphane [email protected]://stephane.ducasse.free.fr/
A Little Journey in the Smalltalk Model
![Page 2: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/2.jpg)
S.Ducasse 2
A pure and minimal object model
Less is more!
![Page 3: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/3.jpg)
S.Ducasse 3
No constructorsNo types declarationNo interfacesNo packages/private/protectedNo parametrized typesNo boxing/unboxing
Still powerful
![Page 4: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/4.jpg)
S.Ducasse 4
1600 simultaneous users1.9 billions objects10 000 updates/day
QuickTime™ and aBMP decompressor
are needed to see this picture.
QuickTime™ and aBMP decompressor
are needed to see this picture.
![Page 5: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/5.jpg)
S.Ducasse 5
QuickTime™ and aBMP decompressor
are needed to see this picture.
QuickTime™ and aBMP decompressor
are needed to see this picture.
QuickTime™ and aBMP decompressor
are needed to see this picture.
QuickTime™ and aBMP decompressor
are needed to see this picture.
QuickTime™ and aBMP decompressor
are needed to see this picture.
![Page 6: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/6.jpg)
S.Ducasse 6
Objects are instances of Classes
![Page 7: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/7.jpg)
S.Ducasse 7
Objects are instances of Classes
(10@200)
![Page 8: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/8.jpg)
S.Ducasse 8
Objects are instances of Classes
(10@200) class
![Page 9: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/9.jpg)
S.Ducasse 9
Objects are instances of Classes
(10@200) classPoint
![Page 10: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/10.jpg)
S.Ducasse 10
Classes are objects too
![Page 11: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/11.jpg)
S.Ducasse 11
Classes are objects too
Point selectors
![Page 12: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/12.jpg)
S.Ducasse 12
Classes are objects too
Point selectors
> an IdentitySet(#eightNeighbors #+ #isZero #sortsBefore: #degrees #printOn: #sideOf: #fourNeighbors #hash #roundUpTo: #min: #min:max: #max #adaptToCollection:andSend: #quadrantOf: #crossProduct: #= #nearestPointOnLineFrom:to: #bitShiftPoint: #* #guarded #insideTriangle:with:with: #grid: #truncateTo: #y #setR:degrees: #normal #directionToLineFrom:to: #truncated #nearestPointAlongLineFrom:to: #theta #scaleTo: #encodePostscriptOn: #> #asPoint #extent: #r #roundTo: #max: #interpolateTo:at: #triangleArea:with: #angleWith: #dotProduct: #isSelfEvaluating #'<=' #to:intersects:to: #'//' #isInsideCircle:with:with: #< #scaleFrom:to: #corner: #to:sideOf: #x #'>=' #roundDownTo: #onLineFrom:to:within: #transposed #ceiling #angle #basicType #translateBy: #asFloatPoint #'\\' #adaptToNumber:andSend: #abs #negated #octantOf: #asIntegerPoint #flipBy:centerAt: #scaleBy: #floor #onLineFrom:to: #isPoint #reflectedAbout: #/ #dist: #asNonFractionalPoint #bearingToPoint: #reciprocal #rotateBy:centerAt: #rotateBy:about: #rounded #setX:setY: #squaredDistanceTo: #normalized #veryDeepCopyWith: #- #storeOn: #rect: #deepCopy #isIntegerPoint #min #adhereTo: #adaptToString:andSend:)
![Page 13: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/13.jpg)
S.Ducasse 13
Classes are objects too
Point instVarNames
![Page 14: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/14.jpg)
S.Ducasse 14
Classes are objects too
Point instVarNames >#('x' 'y')
![Page 15: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/15.jpg)
S.Ducasse 15
Methods are public
![Page 16: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/16.jpg)
S.Ducasse 16
Instance variables are protected
![Page 17: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/17.jpg)
S.Ducasse 17
Single Inheritance
![Page 18: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/18.jpg)
S.Ducasse 18
Single Inheritance
Object subclass: #PointinstanceVariableNames: 'x y'classVariableNames: ''poolDictionaries: ''category: 'Graphics-Primitives'
![Page 19: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/19.jpg)
S.Ducasse 19
1
2
![Page 20: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/20.jpg)
S.Ducasse 20
Classes are objects too
![Page 21: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/21.jpg)
S.Ducasse 21
Classes are objects too
Point class
![Page 22: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/22.jpg)
S.Ducasse 22
Classes are objects too
Point class>Point class
![Page 23: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/23.jpg)
S.Ducasse 23
Classes are objects too
Point class>Point class
“Point class” is an anonymous class with only one instance: Point
![Page 24: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/24.jpg)
S.Ducasse 24
Class Parallel Inheritance
![Page 25: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/25.jpg)
S.Ducasse 25
Lookup and Class Methods
1
2
1
2
Workstation withName: ‘BigMac’
aWorkstation name
![Page 26: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/26.jpg)
S.Ducasse 26
About the Buttons
![Page 27: 8 - OOP - Smalltalk Model](https://reader033.fdocuments.net/reader033/viewer/2022061207/5484d3155806b5d1588b467a/html5/thumbnails/27.jpg)
S.Ducasse 27
Summary- Everything is an object- One single model- Single inheritance- Public methods- Protected attributes- Classes are simply objects too- Class is instance of another class- One unique method lookup look in the class of the receiver