Hi -- On Sun, 6 Jul 2008, phlip wrote: > 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. I don't think DSL's are obliged to be any more like English than any other L's are :-) I believe Jim Weirich uses the example of chess notation, which is a DSL and is certainly arcane if you don't have the specialized background for it. That's OK; domains are specialized, so there's no reason DSL's shouldn't be. There's nothing about domain specificity, per se, that militates for wide comprehensibility. It's more often a matter of giving specialists the communication tools that they need and that the ambient natural language doesn't offer. There's also the contrast between creating a Domain Specific Language and simply using domain-specific language.[1] find_by_name is an expressive method name, but I don't think it's part of an identifiable language (other than Ruby I mean :-) David [1] http://dablog.rubypal.com/2007/4/17/the-l-in-dsl-langue-ou-langage -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails July 21-24 Edison, NJ Advancing With Rails August 18-21 Edison, NJ See http://www.rubypal.com for details and updates!