[Nitro] Nitrous blog category and categories

Robert Mela rob at robmela.com
Sun Sep 9 15:13:21 EDT 2007

I read and understand what you've written.  Nitro is really good at 
working like I expect, and it's great that

- Og uses singular for table names and directories
- Router mount points are left to developer discretion in Nitro
- Router mount point names are independent of table names

Nitro in fact makes the consistency I'm suggesting possible.

What I'm saying is that

 - I don't think that REST specifies use of plurals as REST controller nouns
 - Using plurals introduces inconsistencies all its own, and is more 
trouble than its worth

It makes sense, if we think of a REST controller noun as opposed to an 
English noun, to use "comment" to list all comments.   It only looks 
funny at first due to our inability to think outside our European grammars.

Even if one decides that morphology matters here, then the flip side is 
that "/comments/11" is a silly way to retrieve a single comment!   So do 
we have /comment/11 and /comments?

It's rife with inconsistencies!   And it gets confusing when half the 
English speaking population doesn't know criteria / criterium, 
hypothesis / hypotheses,  and our zoo database needs elk/elk and 
deer/deer, and our sidewalk has passerby / passersby...

It's weird, it's ugly, it doesn't match the table and class names... and 
I can't even see any official standards that say the controller noun 
needs to be plural.  If REST-mania had started in Japan there would be 
no such issue, as there's no morphological change to indicate plural!

Nitro does a great job of breaking away from Rails on this -- it'd be 
wonderful to maintain that simplicity and consistency in REST on Nitro.

George Moschovitis wrote:
>     I think the Rails convention of tablename := pluralized modelname is
>     like so totally Yuck-O-la. 
> Hello Robert,
> Og uses singular for table names. And we use  singular for all 
> directories.
>          app.dispatcher.root.comments = Comment
>          app.dispatcher.root.categories = Category
> this has nothing to do with the database or the tables. A plural is 
> used here to provide standard REST urls:
> /comments -> lists the comments
> /comments/view/1 -> view comment 1
> it makes not much sense to use /comment to list all comments. However, 
> since we use singular in all other places in Nitro/Og, for some time 
> now I am thinking to use singular even on controller mount points. 
> This is a personal decision though.
> The important thing is that Nitro/Og uses singular throughout, but 
> allows the  developer to override this (as is the case in the Blog 
> example: the developer (me) decided to use plural names as mount points)
> regards,
> George.
>     I had to add a "to_link" method to the models to get the demo to run.
>     In category.rb I added
>     class Category
>       def to_link
>           "<a href='/category/view/#{oid}'>#{title}</a>"
>       end
>     ... but the dispatcher path is /categories/!  D'oh!
>     And in Rails we type "Category.find" to get many categories from a
>     table
>     full of categories....
>     The morphology of pluralization is an artifact of the European
>     grammars
>     burned into our brains.  Think of Japanese.   Would a Japanese
>     programmer be at any disadvantage for the lack of pluralization in her
>     table names?
>     Heck, case and gnarly verb conjugations are part of how we think.   We
>     don't add those to our programming conventions ( except in variable
>     names ).   So why bother with plurals, when
>     1) the information it's intended to convey is already clear from
>     context
>     2) It's excess code
>     3) It's complicated
>       -- elk -> elk
>       -- does it do latin?
>       -- Is it available in Finnish
>       -- what about the languages where it's a no-op?
>     4) It introduces inconsistencies in usage ( Category.find -- looks
>     in a
>     group of many categories, may return many categories... etc.)
>     I bet the reason plurals are part of the convention is because...uh,
>     because we can.  A few simple rules, and a dictionary for the
>     exceptions....
>     _______________________________________________
>     Nitro-general mailing list
>     Nitro-general at rubyforge.org <mailto:Nitro-general at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/nitro-general
>     <http://rubyforge.org/mailman/listinfo/nitro-general>
> -- 
> http://www.me.gr
> http://phidz.com
> http://blog.gmosx.com
> http://cull.gr
> http://www.joy.gr
> http://nitroproject.org 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070909/99c926f2/attachment.vcf 

More information about the Nitro-general mailing list