Summary
The object-oriented paradigm tends to make us see things in terms of what they are instead of what they do. To communicate in the form of instructions rather than objects, Ruby provides the mechanism of passing blocks to iterators. We have used iterators before; today we learned to write them ourselves.
We also were introduced to procedure objects, which wrap blocks up so that they can be assigned to variable names and passed around just like other objects.
Before we can produce truly reusable code (or, as some folks say, reuseful code), we'll need to know how to design nice intuitive interfaces. So tomorrow we'll be using what we learned today to follow up on the discussion from Day 11. The goal will be kind of informal protocol, or ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access