Skip to content

Instantly share code, notes, and snippets.

@yhordi
yhordi / README.md
Last active August 29, 2015 14:26
refactored code from my "Applying Object Orientation"

Flexibility

Part of why we want to separate code into separate classes and modules is that it keeps things flexible. For example, let's say that there is no GothamCrimeFigher class and there is only a Human class. If we wanted to include the UtilityBelt module in the human class we would be giving all humans utility belts. While this would be fantastic, it is unnecessary. Therefore, we abstract out the functionality that is not shared across all of humanity into a subclass that we can change as we see fit

Modules vs Classes