Saturday, March 10, 2007

Seeing Rails as a domain-specific language PART1: in definition

A DSL is a language designed to be used for a specific task or set of tasks in a particular field or domain, rather than for general-purpose programming.

Rails is likewise a DSL written in Ruby. It’s true that Rails applications span a wide range of use and usefulness; and looking at the whole spectrum of Rails applications, from shopping sites to bulletin boards to bug-trackers, there may not seem to be anything specific about the Rails domain. But that’s just a reflection of the wide range of Web sites. Looking at it from the programming angle, Rails does have a specific domain: Web applications, particularly interactive, database-driven Web applications. ——我Rails就做这个做到极致,其它的都不管。所以,认为Rails是DSL是合适的。

It’s important to develop a sense of how the specificity of Rails is engineered and how it relates to Ruby. Rails, especially to someone who hasn’t seen much Ruby code outside of Rails, exhibits specificity at two levels: in the syntax, and in the terminology.

No comments: