022 RR When to Use Modules




The Ruby Rogues show

Summary: This Week's Panel  Avdi Grimm (twitter github blog book) Charles Max Wood (twitter github Teach Me To Code) James Edward Gray (blog twitter github) Josh Susser (twitter github blog) Discussed in this Episode Articles mentioned by James: http://twitter.com/#!/rbates/status/105705683751669761 http://twitter.com/#!/rbates/status/105706035548930048 http://blog.steveklabnik.com/2011/09/22/extracting-domain-models-a-practical-example.html http://blog.steveklabnik.com/2011/09/23/more-rstat-dot-us-refatoring.html Destroy All Software Cheating Multiple Inheritance Namespacing Mix-ins Code Organization DRY Principle ActiveRecord's create and create! methods Code's primary purpose is the conversation it has with the reader Put methods in a place where we can look at related methods together method_locator using Module included hook include extend to_enum method_missing delegation and forwardable libraries delgate objects When to use modules shared functionality managing delegation grouping like functionality only including a module when you need the functionality limit my black magic namespacing replace a method breaking down into more granular business objects Destroy All Software There is a performance tradeoff when you include a module (it flushes the method cache) Picks Speakerdeck.com (Josh) greplin.com (Josh) A Fire Upon The Deep (Josh) A Deepness in the Sky (Josh) The Children of the Sky (Josh) Peter Cooper's Ruby 1.9 Walkthrough Video (James) KdenLive (Avdi) Org2Blog (Avdi) Instructure Canvas (open source version) (Chuck) Vimeo (Chuck)