8 - OOP - Smalltalk Model

1,008 views
908 views

Published on

Published in: Education, Technology, Spiritual
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,008
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

8 - OOP - Smalltalk Model

  1. 1. Stéphane Ducasse 1 Stéphane Ducasse stephane.ducasse@inria.fr http://stephane.ducasse.free.fr/ A Little Journey in the Smalltalk Model
  2. 2. S.Ducasse 2 A pure and minimal object model Less is more!
  3. 3. S.Ducasse 3 No constructors No types declaration No interfaces No packages/private/protected No parametrized types No boxing/unboxing Still powerful
  4. 4. S.Ducasse 4 1600 simultaneous users 1.9 billions objects 10 000 updates/day QuickTime™ and a BMP decompressor are needed to see this picture. QuickTime™ and a BMP decompressor are needed to see this picture.
  5. 5. S.Ducasse 5 QuickTime™ and a BMP decompressor are needed to see this picture. QuickTime™ and a BMP decompressor are needed to see this picture. QuickTime™ and a BMP decompressor are needed to see this picture. QuickTime™ and a BMP decompressor are needed to see this picture. QuickTime™ and a BMP decompressor are needed to see this picture.
  6. 6. S.Ducasse 6 Objects are instances of Classes
  7. 7. S.Ducasse 7 Objects are instances of Classes (10@200)
  8. 8. S.Ducasse 8 Objects are instances of Classes (10@200) class
  9. 9. S.Ducasse 9 Objects are instances of Classes (10@200) class Point
  10. 10. S.Ducasse 10 Classes are objects too
  11. 11. S.Ducasse 11 Classes are objects too Point selectors
  12. 12. 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:)
  13. 13. S.Ducasse 13 Classes are objects too Point instVarNames
  14. 14. S.Ducasse 14 Classes are objects too Point instVarNames >#('x' 'y')
  15. 15. S.Ducasse 15 Methods are public
  16. 16. S.Ducasse 16 Instance variables are protected
  17. 17. S.Ducasse 17 Single Inheritance
  18. 18. S.Ducasse 18 Single Inheritance Object subclass: #Point instanceVariableNames: 'x y' classVariableNames: '' poolDictionaries: '' category: 'Graphics-Primitives'
  19. 19. S.Ducasse 19 1 2
  20. 20. S.Ducasse 20 Classes are objects too
  21. 21. S.Ducasse 21 Classes are objects too Point class
  22. 22. S.Ducasse 22 Classes are objects too Point class >Point class
  23. 23. S.Ducasse 23 Classes are objects too Point class >Point class “Point class” is an anonymous class with only one instance: Point
  24. 24. S.Ducasse 24 Class Parallel Inheritance
  25. 25. S.Ducasse 25 Lookup and Class Methods 1 2 1 2 Workstation withName: ‘BigMac’ aWorkstation name
  26. 26. S.Ducasse 26 About the Buttons
  27. 27. 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

×