Modules in Ruby serve two purposes. One is to provide namespace scope for code organization seen in the syntax Test::Unit::TestCase, where TestCase is a class defined inside of the Unit module, which is in turn defined within the Test module. The second purpose of modules is to provide a method for code reuse […]
Archive for November, 2007
Modules Part I - Enter the Include Class
« 25 November 2007 | 19:50 | Ruby Internals, MRI | 4 Comments »Class Methods Part IV - DSL’s
« 16 November 2007 | 11:25 | patterns/idiom/style | Comments Off »This last post in a series on Ruby class methods focuses on Domain Specific Languages.
There are many different types of DSL’s. The broadest classification, coined I believe by Martin Fowler, distinguishes between internal and external DSL’s. External DSL’s are languages with a language specific compiler or interpreter. If you are using YACC […]
Class Methods Part III - Structural Duplication
« 12 November 2007 | 14:53 | patterns/idiom/style | 1 Comment »This post in a series on class methods in Ruby focuses on removing structural duplication.
Whether it’s called OnceAndOnlyOnce or DRY good developers should agree that in the overwhelming majority cases duplication in software is a bad thing. Duplication comes in many forms. The simplest to identify (and remove) is actual text duplication. […]