Skip to content

Instantly share code, notes, and snippets.

@kjs222
Forked from mikedao/modules_questions.markdown
Created April 13, 2016 15:00
Show Gist options
  • Select an option

  • Save kjs222/2f078eaa9d93dfd1aff6f460cc00944b to your computer and use it in GitHub Desktop.

Select an option

Save kjs222/2f078eaa9d93dfd1aff6f460cc00944b to your computer and use it in GitHub Desktop.
  • What do you know about modules already? If little, what would you guess modules are all about?
  • Golf and basketball both use a ball. But if you're on a basketball court and ask for "the ball," no one is going to throw you a golf ball. Why? If you were as dumb as a computer, why would a golfd ball be an acceptable response?
  • You've learned about the object model and method lookups. What would the imapct be of injecting an additional ancestor into a class' lookup chain?
@kjs222
Copy link
Author

kjs222 commented Apr 13, 2016

  1. I know little about modules. I think they are like classes, but only have methods, not state? Maybe a series of behavior that is likely to be needed for a given situation that you can access.
  2. No one throws the golf ball because they take in the context - i.e. that you are standing on a basketball court. The computer doesn't know your context unless you tell it. So it has no basis on which to decide what type of ball to send of all the types of ball it knows about.
  3. It would give that class access to the methods in the module. The module methods would be superceded by the methods in the class it self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment