Summary

We've just been introduced to a couple of concepts that are central to object-oriented programming with Ruby. Inheritance is a standard OO technique that allows us to program incrementally. It lets us establish categorical relationships among classes, specifying only the differences, and so keeping our code from becoming too repetitious. But mix-in of modules is more specific to Ruby. It lets us easily bring various kinds of functionality into a class without complicating the inheritance structure.

Inheritance is the broader concept of the two, because it implies both what an object “is” and what it can do; mix-in is mostly just concerned with capability, not identity.

Tomorrow we'll start to work on the organizational and logical skills ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.