Your SlideShare is downloading. ×
Ruby OOP: Objects over Classes
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Ruby OOP: Objects over Classes

3,589
views

Published on

A talk presented in RubyConf India 2010 at Bangalore, India. It revisits the role of objects and classes in Ruby OOP, and encourages programmers to discover a new approach to OOP.

A talk presented in RubyConf India 2010 at Bangalore, India. It revisits the role of objects and classes in Ruby OOP, and encourages programmers to discover a new approach to OOP.

Published in: Technology

1 Comment
2 Likes
Statistics
Notes
  • The code companion for this talk can be found here:
    https://github.com/amanking/rubyconf_india_2010_talk_companion

    The code in comicbook directory was referred to after the comic book cover slide; the code in examples directory was referred to after the 'Finding hints in the real world' slide.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
3,589
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
1
Likes
2
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. Ruby OOP: Objects over Classes
    Aman King
    king@thoughtworks.com
    RubyConf India 2010
  • 2. What is OOP?
  • 3. What is a class?
  • 4. What is an object?
  • 5. But before the serious stuff …
  • 6. Detouring through a comic book universe …
    Image copyrighted by respective owners
    Source: http://www.comics.org/
  • 7. Coming back …
  • 8. What is an object?
  • 9. Something that takes birth …
  • 10. exhibits some behavior …
  • 11. interacts with other objects …
  • 12. and finally dies off
    or
    is simply forgotten …
  • 13. all in an effort to solve a problem.
  • 14. What is a class?
  • 15. A container for related behavior …
  • 16. that a new object can start off with.
  • 17. A class itself is an object …
  • 18. used to create other objects.
  • 19. When creating a new object,
    a class calls the object’s
    private initialize method.
  • 20. Typically a class is named …
  • 21. referenced via
    a global constant variable.
  • 22. A class object can have singleton methods added to it.
  • 23. These singleton methods can be invoked wherever the class object is accessible …
  • 24. aka
    “class-level methods”.
  • 25. Why use classes?
  • 26. Some possible reasons
  • 27. An object remembers the class used to create it …
  • 28. explicit type checking
    using kind_of? …
  • 29. implicit type checking
    using case syntax …
  • 30. implicit type checking
    using rescue syntax.
  • 31. A class can build on other classes:
    inheritance.
  • 32. A class can share state
    across multiple objects:
    @@class_variables.
  • 33. Some good reasons
  • 34. A named container of behavior can have more behavior added to it.
  • 35. Any added behavior becomes part of all objects created by that class.
  • 36. A class can represent
    a common pattern of initialization.
  • 37. Classes improve
    readability and maintainability.
  • 38. What a class is not?
  • 39. The fundamental building block
    of an application.
  • 40. A strong data type.
  • 41. An enforcement of
    contract or limitations
    on how objects can behave.
  • 42. Ruby’s object focus
  • 43. Classes are objects.
  • 44. No static method-lookup tables:
    chain of ancestors.
  • 45. Singleton methods.
  • 46. Private access modifier
    is object-level.
  • 47. Duck typing.
  • 48. Finding hints in the real world …
  • 49. Objects over classes: Consequences
  • 50. Classes and hierarchies
    no longer limit you.
  • 51. Think through the usage of
    class-level methods and variables: globals?
  • 52. Understanding meta-programming is easier.
  • 53. Effective and confident
    use of meta-programming.
  • 54. Final words
  • 55. Objects are first-class citizens.
  • 56. Classes are useful but secondary.
  • 57. Thank you
    king@thoughtworks.com
    http://www.wikyblog.com/AmanKing