Tommy wrote:

>> Look up the expression "Domain Specific Language".

> What do you mean, I have created a couple of them using Antlr, I think I 
> know what a DSL is, but I am not sure what you mean... (maybe because I am 
> not familiar with Rails).

Rails contains several very good examples of DSLs invented _within_ the base 
language. (If your base language can't do that, complain to the management!)

For example, here's the ActiveRecord required to query all posts in the Marvel 
forum written by some dude:

   class Forum < ActiveRecord::Base
     has_many :posts
   end

dudes_posts = Forum.find_by_name('Marvel').posts.find_by_author('some dude')

The goal of a DSL is you can read that statement, from left to right, and it 
sounds like (admittedly fractured) English.

ActiveRecord rewards this readability by packing two SELECT statements into one 
Ruby statement, and by declaring Forum.has_many :posts in one DRY location. 
("Don't Repeat Yourself.") Raw SQL is also a DSL, but it's bound to performance, 
so it forces you to repeatedly redeclare the relation between Forums and Posts.

You can do a lot of Ruby without Rails, but Rails and its documentation contain 
many state-of-the-art examples of Ruby in action.

-- 
   Phlip