[Nitro] Nitrous blog category and categories

Robert Mela rob at robmela.com
Sun Sep 9 06:45:16 EDT 2007


Is there a REST spec?  "Plural" does not appear in Fielding's
dissertation.   The Wikipedia article on Restful_State_Transfer lists
these as REST URLS:

        http://example.com/users/
        http://example.com/users/{user} (one for each user)
        http://example.com/findUserForm
        http://example.com/locations/
        http://example.com/locations/{location} (one for each location)
        http://example.com/findLocationForm
        
I suspect, but do not know, that a NOUN is a controller noun as defined
by REST, and it's accidental that we use natural language nouns. And
when we do use natural language nouns, the plural/singular is a
stylistic, arbitrary matter.

Maybe I'm just Googling in all the wrong places :(


 
On Sun, 2007-09-09 at 10:33 +0300, 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
>         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


More information about the Nitro-general mailing list