a little journey in the smalltalk model
DESCRIPTION
A Little Journey in the Smalltalk Model. A pure and minimal object model Less is more!. No constructors No types declaration No interfaces No packages/private/protected No parametrized types No boxing/unboxing Still powerful. 1600 simultaneous users 1.9 billions objects - PowerPoint PPT PresentationTRANSCRIPT
Stéphane Ducasse 1
Stéphane [email protected]://stephane.ducasse.free.fr/
A Little Journey in the Smalltalk Model
S.Ducasse 2
A pure and minimal object model
Less is more!
S.Ducasse 3
No constructorsNo types declarationNo interfacesNo packages/private/protectedNo parametrized typesNo boxing/unboxing
Still powerful
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.
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.
S.Ducasse 6
Objects are instances of Classes
S.Ducasse 7
Objects are instances of Classes
(10@200)
S.Ducasse 8
Objects are instances of Classes
(10@200) class
S.Ducasse 9
Objects are instances of Classes
(10@200) classPoint
S.Ducasse 10
Classes are objects too
S.Ducasse 11
Classes are objects too
Point selectors
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:)
S.Ducasse 13
Classes are objects too
Point instVarNames
S.Ducasse 14
Classes are objects too
Point instVarNames >#('x' 'y')
S.Ducasse 15
Methods are public
S.Ducasse 16
Instance variables are protected
S.Ducasse 17
Single Inheritance
S.Ducasse 18
Single Inheritance
Object subclass: #PointinstanceVariableNames: 'x y'classVariableNames: ''poolDictionaries: ''category: 'Graphics-Primitives'
S.Ducasse 19
1
2
S.Ducasse 20
Classes are objects too
S.Ducasse 21
Classes are objects too
Point class
S.Ducasse 22
Classes are objects too
Point class>Point class
S.Ducasse 23
Classes are objects too
Point class>Point class
“Point class” is an anonymous class with only one instance: Point
S.Ducasse 24
Class Parallel Inheritance
S.Ducasse 25
Lookup and Class Methods
1
2
1
2
Workstation withName: ‘BigMac’
aWorkstation name
S.Ducasse 26
About the Buttons
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