SlideShare a Scribd company logo
Understanding Ruby’s Object Model Chris Pine July 10, 2003
Some Ruby Basics 1234567.class     Fixnum ' hello ' .class     String
Some Ruby Basics 1234567.class     Fixnum ' hello ' .class     String Fixnum.superclass     Integer String.superclass     Object
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
A Little Quiz Object.kind_of?(Object)     ?
A Little Quiz Object.kind_of?(Object)     true Object.kind_of?(Class)     ?
A Little Quiz Object.kind_of?(Object)     true Object.kind_of?(Class)     true Class.kind_of?(Object)     ?
A Little Quiz Object.kind_of?(Object)     true Object.kind_of?(Class)     true Class.kind_of?(Object)     true Class.kind_of?(Class)     ?
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)     ?
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)     ?
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)     ?
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
Wrong Mental Picture Object class Classes Subclasses objects
What We Know… aClass.superclass.superclass…    Object Object.superclass     nil
What We Know… aClass.superclass.superclass…    Object Object.superclass     nil anObject.class.class…     Class Class.class     Class
What We Know… aClass.superclass.superclass…    Object Object.superclass     nil anObject.class.class…     Class Class.class     Class aClass.class     Class anObject.class.class     Class
Superclass Relationships Object Module Class String Integer Fixnum
Class Relationships Object Module String Integer Fixnum 5 ' hi ' Class
Relationships anObject.class aClass.superclass anObject.kind_of? *
Right Mental Picture Object Module Class String Integer Fixnum 5 ' hi '
Modules module FooMod  class String def foo  include FooMod ' BIGFOO! '  end end end Object Proxy: FooMod foo String reverse split …
Singleton Classes (objects) me =  ' Chris ' def me.wife ' Katy ' end String 'Chris'(S) ' Chris ' reverse split … wife
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
Singleton Classes (classes) Polygon Triangle hypotenuse area largest new Class Polygon(S) ? ? ? ?
Polygon Triangle hypotenuse area largest new Class Poly(S) Tri(S) Object Obj(S) Class(S) Mod(S) Module
 

More Related Content

PPT
Yahoo!%20Media%20Plan.ppt
PPS
Sé Catedral
PDF
8efficiency
PDF
Christian Beckett Cv
PPT
Imagens de Salvador
PPS
Elejedelmal
ODP
Intro Ruby Classes Part I
PPTX
6 Object Oriented Programming
Yahoo!%20Media%20Plan.ppt
Sé Catedral
8efficiency
Christian Beckett Cv
Imagens de Salvador
Elejedelmal
Intro Ruby Classes Part I
6 Object Oriented Programming

Similar to ChrisPine_UROM.ppt (20)

KEY
Ruby objects
DOCX
Ruby Interview Questions
PPTX
Ruby object model - Understanding of object play role for ruby
PPTX
Introduction to the Ruby Object Model
KEY
Metaprogramming Primer (Part 1)
PDF
Ruby object model at the Ruby drink-up of Sophia, January 2013
KEY
Introducing Ruby
PPTX
Ruby :: Training 1
PDF
Pharo Hands-on: 05 object model
PDF
The Ruby Object Model by Rafael Magana
PPTX
Ruby OOP: Objects over Classes
PPTX
Deciphering the Ruby Object Model
KEY
An introduction to Ruby
PPTX
07 intro2 oop
PPTX
Ruby for .NET developers
PDF
Introduction to Ruby Programming Language
PPTX
Ruby data types and objects
PDF
The Joy Of Ruby
PDF
PDF
Aman kingrubyoo pnew
Ruby objects
Ruby Interview Questions
Ruby object model - Understanding of object play role for ruby
Introduction to the Ruby Object Model
Metaprogramming Primer (Part 1)
Ruby object model at the Ruby drink-up of Sophia, January 2013
Introducing Ruby
Ruby :: Training 1
Pharo Hands-on: 05 object model
The Ruby Object Model by Rafael Magana
Ruby OOP: Objects over Classes
Deciphering the Ruby Object Model
An introduction to Ruby
07 intro2 oop
Ruby for .NET developers
Introduction to Ruby Programming Language
Ruby data types and objects
The Joy Of Ruby
Aman kingrubyoo pnew
Ad

More from hackday08 (15)

PPT
WOW.PPT
PPT
14_amen_wow.ppt
PPT
Doing%20Business%20in%20India%20Breakfast%20Seminar%20-%20Hunt%20PPP%20(6).PPT
PPT
Indian%20Law.ppt
PPT
Hermeneutics_Quiz.ppt
PPT
LCcharge_JHU.ppt
PPT
2005YRBSslides-SexualRisk.ppt
PPT
CHEM1010-Fall_04-22.ppt
PPT
CHEM1010-Fall_04-22.ppt
PPT
CHEM1010-Fall_04-22.ppt
PPT
CHEM1010-Fall_04-22.ppt
PPT
dh-slides-perf.ppt
PPT
dh-slides-perf.ppt
PPT
CHEM1010-Fall_04-22.ppt
PPT
CHEM1010-Fall_04-22.ppt
WOW.PPT
14_amen_wow.ppt
Doing%20Business%20in%20India%20Breakfast%20Seminar%20-%20Hunt%20PPP%20(6).PPT
Indian%20Law.ppt
Hermeneutics_Quiz.ppt
LCcharge_JHU.ppt
2005YRBSslides-SexualRisk.ppt
CHEM1010-Fall_04-22.ppt
CHEM1010-Fall_04-22.ppt
CHEM1010-Fall_04-22.ppt
CHEM1010-Fall_04-22.ppt
dh-slides-perf.ppt
dh-slides-perf.ppt
CHEM1010-Fall_04-22.ppt
CHEM1010-Fall_04-22.ppt
Ad

Recently uploaded (20)

PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Approach and Philosophy of On baking technology
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
DP Operators-handbook-extract for the Mautical Institute
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Hindi spoken digit analysis for native and non-native speakers
A novel scalable deep ensemble learning framework for big data classification...
Chapter 5: Probability Theory and Statistics
Approach and Philosophy of On baking technology
A comparative analysis of optical character recognition models for extracting...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
SOPHOS-XG Firewall Administrator PPT.pptx
Getting Started with Data Integration: FME Form 101
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Web App vs Mobile App What Should You Build First.pdf
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25-Week II
Heart disease approach using modified random forest and particle swarm optimi...
OMC Textile Division Presentation 2021.pptx
1. Introduction to Computer Programming.pptx
MIND Revenue Release Quarter 2 2025 Press Release
A comparative study of natural language inference in Swahili using monolingua...
WOOl fibre morphology and structure.pdf for textiles
DP Operators-handbook-extract for the Mautical Institute

ChrisPine_UROM.ppt

  • 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
  • 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.