• Like
ChrisPine_UROM.ppt
Upcoming SlideShare
Loading in...5
×

ChrisPine_UROM.ppt

  • 361 views
Uploaded on

Uploaded from SlideSearch via http://www.ruby-doc.org/docs/Understanding%20Ruby's%20Object%20Model/ChrisPine_UROM.ppt

Uploaded from SlideSearch via http://www.ruby-doc.org/docs/Understanding%20Ruby's%20Object%20Model/ChrisPine_UROM.ppt

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
361
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Understanding Ruby’s Object Model Chris Pine July 10, 2003
  • 2. Some Ruby Basics
    • 1234567.class  Fixnum
    • ' hello ' .class  String
  • 3. Some Ruby Basics
    • 1234567.class  Fixnum
    • ' hello ' .class  String
    • Fixnum.superclass  Integer
    • String.superclass  Object
  • 4. Some Ruby Basics
    • 1234567.class  Fixnum
    • ' hello ' .class  String
    • Fixnum.superclass  Integer
    • String.superclass  Object
    • ' hello ' .kind_of?(String)  true
    • 1234567.kind_of?(Integer)  true
    • 1234567.kind_of?(String)  false
  • 5. A Little Quiz
    • Object.kind_of?(Object)  ?
  • 6. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  ?
  • 7. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  ?
  • 8. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  true
    • Class.kind_of?(Class)  ?
  • 9. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  true
    • Class.kind_of?(Class)  true
    • ' hey ' .kind_of?(String)  ?
  • 10. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  true
    • Class.kind_of?(Class)  true
    • ' hey ' .kind_of?(String)  true
    • String.kind_of?(Class)  ?
  • 11. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  true
    • Class.kind_of?(Class)  true
    • ' hey ' .kind_of?(String)  true
    • String.kind_of?(Class)  true
    • Fixnum.kind_of?(Integer)  ?
  • 12. A Little Quiz
    • Object.kind_of?(Object)  true
    • Object.kind_of?(Class)  true
    • Class.kind_of?(Object)  true
    • Class.kind_of?(Class)  true
    • ' hey ' .kind_of?(String)  true
    • String.kind_of?(Class)  true
    • Fixnum.kind_of?(Integer)  false
  • 13. Wrong Mental Picture Object class Classes Subclasses objects
  • 14. What We Know…
    • aClass.superclass.superclass…
    •  Object
    • Object.superclass  nil
  • 15. What We Know…
    • aClass.superclass.superclass…
    •  Object
    • Object.superclass  nil
    • anObject.class.class…  Class
    • Class.class  Class
  • 16. What We Know…
    • aClass.superclass.superclass…
    •  Object
    • Object.superclass  nil
    • anObject.class.class…  Class
    • Class.class  Class
    • aClass.class  Class
    • anObject.class.class  Class
  • 17. Superclass Relationships Object Module Class String Integer Fixnum
  • 18. Class Relationships Object Module String Integer Fixnum 5 ' hi ' Class
  • 19. Relationships
    • anObject.class
    • aClass.superclass
    • anObject.kind_of?
    *
  • 20. Right Mental Picture Object Module Class String Integer Fixnum 5 ' hi '
  • 21. Modules
    • module FooMod class String
    • def foo include FooMod
    • ' BIGFOO! ' end
    • end
    • end
    Object Proxy: FooMod foo String reverse split …
  • 22. Singleton Classes (objects)
    • me = ' Chris '
    • def me.wife
    • ' Katy '
    • end
    String 'Chris'(S) ' Chris ' reverse split … wife
  • 23. Singleton Classes (classes)
    • poly = Polygon.new
    • poly.area  12.823
    • Polygon.largest  poly
    • tri = Triangle.new
    • tri.area  9.816
    • tri.hypotenuse  7.244
    • Triangle.largest  tri
  • 24. Singleton Classes (classes) Polygon Triangle hypotenuse area largest new Class Polygon(S) ? ? ? ?
  • 25. Polygon Triangle hypotenuse area largest new Class Poly(S) Tri(S) Object Obj(S) Class(S) Mod(S) Module
  • 26.