A RubyOnRails design guideline that avoids ConfigurationHell by - sometimes - correctly guessing what you mean.
For example, this line configures your Order object to link through your database to your Line_Item objects:
Order has_many :line_itemsThat is a few delimiters away from gramatically correct English.
The system works because each Line_Item object has an order_id, and the Order has an id, so the system uses these fields for its join. (If your database schema doesn't yet support ConventionOverConfiguration, add an SQL VIEW and keep going. Or configure Rails.)
No programming language should attempt a "ReadProgrammersMindMode". ConventionOverConfiguration works by leveraging a SystemMetaphor and UbiquitousLanguage, which are already GoodThings. They assist communication inside your program just as well as they assist it within your WholeTeam. Rails even goes so far as to normalize the plurals - Line_Item -> line_items.
I've had Rails explained to me in person a few times, and I find it interesting that every time, the part about automatically pluralizing nouns comes at the end of the explanation, neatly tacked on as a "bonus" feature. I've asked a couple times what it does with nouns that have irregular plural forms. Analysis, person, criterion, etc. I don't recall the exact answers I've got. Maybe it handles some special cases. To me, the existence of special cases would rule-out including the pluralization feature. But that argument probably works just as well for any computer language feature that tries to resemble natural language. It will lead to confusion and awkwardness in rough proportion to the incidence of special cases in the given natural language. In the case of English, it just seems like a bad idea to try. -- MichaelSparks
It might use http://rubyforge.org/projects/localization/ aka localization_generator , which might work for other languages and might not. This would be thin ice indeed if ... it were causing any fragility, which the otherwise rabid RubyOnRails community might be expected to notice, right? This works:
assert_equal 'errata', 'erratum'.pluralizeIn Agile Web Development with Rails, DavidHeinemeierHansson's excuse for this attrocity is straight AgileAlliance dogma: UbiquitousLanguage, CommunityAgreements?, SystemMetaphor, ValueCommunication?, etc. etc. For once, this stuff might look a little silly, from the outside, but it sure blows ApacheTomcat back into the StoneAge?, huh? --PhlIp
Convention Over Configuration works well in RubyOnRails because configuration is still an option! If you have some weird word that the system isn't correctly mapping (and it does work for most weird words like "mouse" and "person" without a hitch) then just specify the table yourself. Everything that Rails does "for you" can be done by hand if you'd like, and it ends up being much simpler than overriding the default behaviours of some other web APIs, *cough* DotNet *cough* ... excuse me.
Further, Ruby's endlessly extensible object systems often allow you to configure at the point where you would have convened. The above has_many call has many more optional parameters.
For example, I recently switched my version of it to has_one ;-)