Ruby on Rails has given me a passion for elegant code. I guess it's always been there, but not so much attainable with other languages or frameworks. A large part of Rails' elegance comes from it's extensive use of Ruby's mixins, which allows you to inherit methods from multiple sources. One of the ways I've kept doodlekit elegant, or at least attempted to, is through the use of Rails plugins. At first I was a little scared of the thought of writing plugins. "I don't have time to learn another architecture" I told myself. Then I realized, "Wait a minute, this is Rails, it can't be that bad". Plugins are very simple which is what makes them so wonderful. At their core, they're a directory with an init.rb file and a lib directory with ruby scripts. The lib directory usually contains Modules aka Mixins and the init.rb will be automatically run and dynamically apply the mixins to other classes....
Content suppressed by ://URLFAN, for full article visit source