Day 11 – Program organization, Part 3 of 3.
Today, Slagell clarifies the difference between classes and modules. As I mentioned back in my review of The Object-Oriented Thought Process, a ‘class’ in object-oriented programming is a noun, a Thing. Like a chair, a sweater, or Slartibartfast. Modules are like adjectives. All the nouns I mentioned above could, in fact, be furry. So, if the chair, sweater, and Slartibartfast were classes, they could be all
include the same
He also offers an solution for the deck of cards exercise. Rather than creating a ‘collection’ class, Slagell subclassed Ruby’s own Array class for Deck. Fine enough. He starts with the
shuffle method within the Deck class, finally moving it to the Array class (as made more sense to me) before wrapping up the chapter.