academia.sh
/
Ruby
/
Object Orientation and Metaprogramming
Course
Intermediate
Object Orientation and Metaprogramming
Published
October 16, 2026
·
Updated
October 21, 2026
By the end of this course
Organizes state and behavior with classes, inheritance and super
Shares behavior through modules and mixins
Explains the method lookup chain and measures where in the chain a method is defined
Distinguishes whether a method was written by the programmer, by an ancestor or by code that generates it, or has no definition at all
Uses metaprogramming tools in a measured and readable way
01
Instance variables living in the object and methods in the class, inheritance and reaching the superclass with super, sharing behavior without multiple inheritance through modules, public, protected and private methods, and how the ancestor chain is resolved.
01
Class Definition and Instance Variables
Classifying who wrote a method with four authors; instance variables living in the object and methods in the class; initialize being private; how a method written with attr_reader differs from one written with def.
02
Inheritance and `super`
An empty subclass taking a method from its superclass; the ancestor chain with superclass and ancestors; super in an overriding method; super inside initialize; the difference between bare super and super(...).
03
Modules and Mixins
How a module differs from a class; mixing a module into the ancestor chain with include; Comparable and <=>; order among two modules of the same name; extend on a single object.
04
Visibility
Public, protected and private methods; refusal of a call from outside, the difference between send and public_send, the self receiver, a protected method working on another object of the same class, and changing visibility in a subclass.
05
The Method Lookup Chain
How a method is searched in the ancestor chain when a message reaches the receiver; a prepended module, super_method, the end of the chain, the chain of class methods and a singleton method added to a single object.
02
Querying objects at run time, defining methods with code that writes code, proxy objects that catch missing methods and their risks, and building domain-specific languages with declarative interfaces.
01
Reflection
Measuring how to ask an object about its own methods, state and type at run time, and how those questions classify who wrote a method.
02
Dynamic Method Definition
Measuring how define_method produces methods at run time, how those methods check their parameters, and how the production classifies the author.
03
Catching Missing Methods
Measuring what Ruby does when a message has no definition, how a class catches it with method_missing, and what reflection reports about the catch.
04
Domain-Specific Languages
Measuring which author hides behind a declaration line such as field :price, 0, where class methods are looked up, and where the block form breaks.
Final exam
Object Orientation and Metaprogramming — Final Exam
In preparation
This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.
Start the exam
↑↓
↵
Esc
navigate · open · close