What is this pluralization in rails?? How is it helpful to anyone? Pluralization is causing more pain and agony to development. I suggest that in the next version get rid of "pluralization" and keep the design simple (whatever the table name in database the same name should be used). Whose idea is this pluralization ? To maintain downward compatibility just provide optional flag to support pluralization. Al Dev, San Jacinto College, ITS _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
In "config/environment.rb" add an entry: ActiveRecord::Base.pluralize_table_names = false That''s all you have to do. On 8/17/05, Dev, Al <Al.Dev-GGtUyPwMHHo@public.gmane.org> wrote:> > > > What is this pluralization in rails?? How is it helpful to anyone? > Pluralization is causing more pain and agony to development. > > I suggest that in the next version get rid of "pluralization" and keep the > design simple (whatever the table name in database the same name should be > used). > > Whose idea is this pluralization ? > > To maintain downward compatibility just provide optional flag to support > pluralization. > > > > Al Dev, San Jacinto College, ITS > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
On 8/17/05, Dev, Al <Al.Dev-GGtUyPwMHHo@public.gmane.org> wrote:> > > > What is this pluralization in rails?? How is it helpful to anyone? > Pluralization is causing more pain and agony to development. > > I suggest that in the next version get rid of "pluralization" and keep the > design simple (whatever the table name in database the same name should be > used). > > Whose idea is this pluralization ? > > To maintain downward compatibility just provide optional flag to support > pluralization.Let''s not go there again. It''s here to stay for the most part, but it''s very easy to turn off: ActiveRecord::Base.pluralize_table_names = false -- rick http://techno-weenie.net
this conversation was just finished a couple days ago... lets put it this way... no one is going to go breaking every existing app.. '' _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
It''s optional now (on by default). -Brian On Aug 17, 2005, at 3:51 PM, Dev, Al wrote:> What is this pluralization in rails?? How is it helpful to anyone? > Pluralization is causing more pain and agony to development. > > I suggest that in the next version get rid of "pluralization" and > keep the design simple (whatever the table name in database the > same name should be used). > > Whose idea is this pluralization ? > > To maintain downward compatibility just provide optional flag to > support pluralization. > > > > Al Dev, San Jacinto College, ITS > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Dev, Al wrote:> I suggest that in the next version get rid of "pluralization" and keep > the design simple (whatever the table name in database the same name > should be used).It is already easy to disable pluralization. If Rails doesn''t pluralize your favorite random word right, you can customize it. If you just don''t like it, disable it. Pluralization allows us to write the names of tables, records, classes as a normal human would. Experienced Ruby developers frequently write code that reads as if it were human text. (See Redhanded for many good examples.) Usually it is those who are still writing (ugly) code for the computer that hate on pluralization. Those people writing those octopus enabled web applications sure love to hate it too. I guess you could make an argument that it makes it harder for non-english speakers. ... ..... And for the record, DHH is the "Whose idea this pluralization is." Respect!
The pluralization code is still loaded and parsed when it''s off, though, yeah? On Aug 17, 2005, at 4:10 PM, Nicholas Seckar wrote:> Dev, Al wrote: > >> I suggest that in the next version get rid of "pluralization" and >> keep the design simple (whatever the table name in database the >> same name should be used). >> > > It is already easy to disable pluralization. If Rails doesn''t > pluralize your favorite random word right, you can customize it. If > you just don''t like it, disable it. > > Pluralization allows us to write the names of tables, records, > classes as a normal human would. > > Experienced Ruby developers frequently write code that reads as if > it were human text. (See Redhanded for many good examples.) Usually > it is those who are still writing (ugly) code for the computer that > hate on pluralization. > > Those people writing those octopus enabled web applications sure > love to hate it too. > > I guess you could make an argument that it makes it harder for non- > english speakers. ... ..... > > And for the record, DHH is the "Whose idea this pluralization is." > Respect! > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Oh my god let it go already. This horse has been beaten 100 feet into the ground. If pluralization is so disgusting to you, even disabled, then write a branch and shut up! Thank you, Jeff Toby Boudreaux wrote:> The pluralization code is still loaded and parsed when it''s off, > though, yeah? > > > On Aug 17, 2005, at 4:10 PM, Nicholas Seckar wrote: > >> Dev, Al wrote: >> >>> I suggest that in the next version get rid of "pluralization" and >>> keep the design simple (whatever the table name in database the >>> same name should be used). >>> >> >> It is already easy to disable pluralization. If Rails doesn''t >> pluralize your favorite random word right, you can customize it. If >> you just don''t like it, disable it. >> >> Pluralization allows us to write the names of tables, records, >> classes as a normal human would. >> >> Experienced Ruby developers frequently write code that reads as if >> it were human text. (See Redhanded for many good examples.) Usually >> it is those who are still writing (ugly) code for the computer that >> hate on pluralization. >> >> Those people writing those octopus enabled web applications sure >> love to hate it too. >> >> I guess you could make an argument that it makes it harder for non- >> english speakers. ... ..... >> >> And for the record, DHH is the "Whose idea this pluralization is." >> Respect! >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I just asked a question -- nobody said I was disgusted with anything. I''d still like to know (without digging through the source) whether the pluralization code/lists are loaded when the feature is disabled. I''m sure someone knows and can give a quick "yes" or "no" instead of a temper tantrum. On Aug 17, 2005, at 4:20 PM, Jeff Casimir wrote:> Oh my god let it go already. This horse has been beaten 100 feet > into the ground. If pluralization is so disgusting to you, even > disabled, then write a branch and shut up! > > Thank you, > Jeff > > Toby Boudreaux wrote: > > >> The pluralization code is still loaded and parsed when it''s off, >> though, yeah? >> >> >> On Aug 17, 2005, at 4:10 PM, Nicholas Seckar wrote: >> >> >>> Dev, Al wrote: >>> >>> >>>> I suggest that in the next version get rid of "pluralization" >>>> and keep the design simple (whatever the table name in database >>>> the same name should be used). >>>> >>>> >>> >>> It is already easy to disable pluralization. If Rails doesn''t >>> pluralize your favorite random word right, you can customize it. >>> If you just don''t like it, disable it. >>> >>> Pluralization allows us to write the names of tables, records, >>> classes as a normal human would. >>> >>> Experienced Ruby developers frequently write code that reads as >>> if it were human text. (See Redhanded for many good examples.) >>> Usually it is those who are still writing (ugly) code for the >>> computer that hate on pluralization. >>> >>> Those people writing those octopus enabled web applications sure >>> love to hate it too. >>> >>> I guess you could make an argument that it makes it harder for >>> non- english speakers. ... ..... >>> >>> And for the record, DHH is the "Whose idea this pluralization >>> is." Respect! >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thank you very much for the succinct, informative response. I can finally stop trying to remember what to pluralize and what not to. I really appreciate the helpfullness of everybody on this mailing list -- no "RTFM NOOB" like the php one. Greatly appreciated! On 8/17/05, Gaetano <gaetanot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In "config/environment.rb" > > add an entry: > > ActiveRecord::Base.pluralize_table_names = false > > That''s all you have to do. > > On 8/17/05, Dev, Al <Al.Dev-GGtUyPwMHHo@public.gmane.org> wrote: > > > > > > > > What is this pluralization in rails?? How is it helpful to anyone? > > Pluralization is causing more pain and agony to development. > > > > I suggest that in the next version get rid of "pluralization" and keep the > > design simple (whatever the table name in database the same name should be > > used). > > > > Whose idea is this pluralization ? > > > > To maintain downward compatibility just provide optional flag to support > > pluralization. > > > > > > > > Al Dev, San Jacinto College, ITS > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Brock Weaver http://www.circaware.com
D''oh, spoke too soon -- ruby script/generate scaffold singular_table_name still generates plurals. Is there an option to override that as well? On 8/17/05, Brock Weaver <brockweaver-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you very much for the succinct, informative response. I can > finally stop trying to remember what to pluralize and what not to. > > I really appreciate the helpfullness of everybody on this mailing list > -- no "RTFM NOOB" like the php one. Greatly appreciated! > > On 8/17/05, Gaetano <gaetanot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > In "config/environment.rb" > > > > add an entry: > > > > ActiveRecord::Base.pluralize_table_names = false > > > > That''s all you have to do. > > > > On 8/17/05, Dev, Al <Al.Dev-GGtUyPwMHHo@public.gmane.org> wrote: > > > > > > > > > > > > What is this pluralization in rails?? How is it helpful to anyone? > > > Pluralization is causing more pain and agony to development. > > > > > > I suggest that in the next version get rid of "pluralization" and keep the > > > design simple (whatever the table name in database the same name should be > > > used). > > > > > > Whose idea is this pluralization ? > > > > > > To maintain downward compatibility just provide optional flag to support > > > pluralization. > > > > > > > > > > > > Al Dev, San Jacinto College, ITS > > > > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Brock Weaver > http://www.circaware.com >-- Brock Weaver http://www.circaware.com
> I''d still like to know (without digging through the source) whether the > pluralization code/lists are loaded when the feature is disabled.Well, probably, but what does it matter? It''s hardly likely to be a huge resource hog. I don''t tend to use floating-point numbers, but I''m not going to complain that Ruby loads in the Float definitions every time. - M
On Wed, 17 Aug 2005, Nicholas Seckar wrote:> Those people writing those octopus enabled web applications sure love to > hate it too.My cephalopod tables can beat up your people tables any day -- and have arms to spare. :) -- _Deirdre web / blog: http://deirdre.net/ yarn: http://fuzzyorange.com cat''s blog: http://fuzzyorange.com/vsd/ "Memes are a hoax! Pass it on!"
On Aug 17, 2005, at 5:29 PM, Matt Powell wrote:>> I''d still like to know (without digging through the source) >> whether the pluralization code/lists are loaded when the feature >> is disabled. >> > > Well, probably, but what does it matter? It''s hardly likely to be a > huge resource hog. I don''t tend to use floating-point numbers, but > I''m not going to complain that Ruby loads in the Float definitions > every time.The cost adds up. Web servers aren''t like desktops, where we have enough memory and CPU to piss away on all manner of groovy eye candy. There is a point where all of the joyful nice touches begin to add up to a lot of extra space and time. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
It matters because full disclosure is important, and because I wanted to know. Isn''t being curious seen as a virtue? ;) On Aug 17, 2005, at 5:29 PM, Matt Powell wrote:>> I''d still like to know (without digging through the source) >> whether the pluralization code/lists are loaded when the feature >> is disabled. >> > > Well, probably, but what does it matter? It''s hardly likely to be a > huge resource hog. I don''t tend to use floating-point numbers, but > I''m not going to complain that Ruby loads in the Float definitions > every time. > > - M > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Rails isn''t gentoo. We load the pluralization stuff even when it''s not used. If you''ve got issues with that, go edit active support and remove the methods which define pluralization. Then give yourself a pat on the back. In the 5 minutes it took you to do that, you could have bought $5 worth of RAM, (say, 10 MB,) which is enough memory to load the pluralization code thousands of times.
I present ''full disclosure'': http://dev.rubyonrails.com/browser/ Be curious, be busy. Don''t keep asking the same question no one else wants to know the answer to. If it is so interesting then I''m sure you and Ed who are so concerned can figure it out. -Jeff Toby Boudreaux wrote:> It matters because full disclosure is important, and because I wanted > to know. Isn''t being curious seen as a virtue? ;) > > > On Aug 17, 2005, at 5:29 PM, Matt Powell wrote: > >>> I''d still like to know (without digging through the source) >>> whether the pluralization code/lists are loaded when the feature >>> is disabled. >>> >> >> Well, probably, but what does it matter? It''s hardly likely to be a >> huge resource hog. I don''t tend to use floating-point numbers, but >> I''m not going to complain that Ruby loads in the Float definitions >> every time. >> >> - M >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >>
On 8/17/05, Jeff Casimir <jeff-+RlNNtFrnNmT15sufhRIGw@public.gmane.org> wrote:> Oh my god let it go already. This horse has been beaten 100 feet into > the ground.Now, I enjoy beating a dead horse as much as the next guy, but I think we''ve gone way past "beating" and are now into "nuclear holocaust" territory here. -- Urban Artography http://artography.ath.cx
on 8/17/2005 3:51 PM Toby Boudreaux said the following:> It matters because full disclosure is important, and because I wanted > to know. Isn''t being curious seen as a virtue? ;)Be curious. The command you are looking for is vi activesupport/inflector.rb Adding "require ''profile''" to your code might also be interesting. Please let us know what you find. Ray
What is this pluralization in rails?? How is it helpful to anyone? Pluralization is causing more pain and agony to development. What is the purpose of having pluralization? I suggest that in the next version get rid of "pluralization" and keep the design simple (whatever the table name in database the same name should be used). Whose idea is this pluralization ? To maintain downward compatibility just provide optional flag to support pluralization. Pluralization causes lot of problems while working with legacy database tables in Oracle, Sybase , MSSQLserver. For example - even if you give set_table_name "blahtable" you will still have problems. Al Dev, San Jacinto College, ITS
Brian McCallister <brian.mccallister@...> writes:> > > It''s optional now (on by default). > > -Brian > > > On Aug 17, 2005, at 3:51 PM, Dev, Al wrote: > > > What is this pluralization in rails?? How is it helpful to anyone?Pluralization is causing more pain and agony to development.> I suggest that in the next version get rid of "pluralization"and keep the design simple (whatever the table name in database the same name should be used).> Whose idea is this pluralization ? > To maintain downward compatibility just provide optional flagto supportpluralization.> > Al Dev, San Jacinto College, ITS > _______________________________________________Why not make it off by default ? The new-comers will be greatly confused by that. Also, the script/generate scaffold still uses by default on. How to tell "generate scaffold" not to use pluralization?
I had to change the source of the generation script: rails-0.13.1/lib/rails_generator/base.rb, line198 should be: plural = ActiveRecord::Base.pluralize_table_names ? under.pluralize : under; rails-0.13.1/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb, line 49 should be: @controller_name = args.shift || (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name) I was going to submit this as a patch, but I''ve never used subversion before, and I am having connection issues (proxy problem I think). At any rate, changing those two lines should remove all pluralization from any of the generator scripts if you set that pluralize_table_names to false. hth On 8/18/05, Al Dev <al.dev-GGtUyPwMHHo@public.gmane.org> wrote:> Brian McCallister <brian.mccallister@...> writes: > > > > > > > It''s optional now (on by default). > > > > -Brian > > > > > > On Aug 17, 2005, at 3:51 PM, Dev, Al wrote: > > > > > > What is this pluralization in rails?? How is it helpful to anyone? > Pluralization is causing more pain and agony to development. > > I suggest that in the next version get rid of "pluralization" > and keep the > design simple (whatever the table name in database the same > name should be used). > > Whose idea is this pluralization ? > > To maintain downward compatibility just provide optional flag > to supportpluralization. > > > > Al Dev, San Jacinto College, ITS > > _______________________________________________ > > > > Why not make it off by default ? > The new-comers will be greatly confused by that. > > Also, the script/generate scaffold still uses by default on. > > How to tell "generate scaffold" not to use pluralization? > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Brock Weaver http://www.circaware.com
Brock Weaver said:> At any rate, changing those two lines should remove all pluralization > from any of the generator scripts if you set that > pluralize_table_names to false.Auto-pluralization is used in several different areas of Rails: * DB table naming (by default). * AR collection naming * Controller naming * Elsewhere? My pet peeve is table naming. (And that''s why I turned it off, so please put down the flame thrower.) I also happen to think that on balance it makes more sense to give controllers singular names. AR collection naming is something that I think should be done explicitly for every relationship, so I personally don''t care what the default is. My point is that these are three different uses of pluralizing. Turning off DB table name pluralization shouldn''t necessarily turn off plural controller names in the scaffold generation code. Regards, Ed -- Transmogrify, LLC * <http://xmog.com>
excuse me. (maybe you shouldnt) my own OPPINION on the pluralization bit. Pluralization: the act of turning a singular item into a form of many. id honestly think pluralization would be easier for newbies. The Database Layer: you dont put PRODUCTS into a table called ''product'' you dont put USERS into a table called ''user'' id imagine most newbs look at a table as MANY records, and this PLURAL! how many of you that actually write sql look at the query "SELECT name FROM user" and dont ever contimplate for 2 seconds why the fuck a table with MANY (ie PLURAL) records has a SINGULAR name attached to it! whats even worse is when homers decide to name there table something like ''name'' and have a field ''name'' in it!!! "select name from name" personally looks a LITTLE fucked up. the book explains this very well, the more you can treat your code like "human" the easier it is for ANYONE to read. "get the admin from users" you know what USERS is cause its PLURAL. now think about "get all users under the age of 20 from account" and dont go WHAT THE FUCK!!! The Application Layer now, when your getting an object your generally not looking for USERS your looking for ''User'' how many of you really go @user = User.find :all NONE, there you guys go breaking your own damn convention! you dont do this cause you KNOW you will change your code in a month and wonder why the fuck @user.name doesnt exist... "OH WHAT? its MANY (yes thats PLURAL) userS ?!?!?! your shittin me arent ya!!!!" a lot of people are still *probably* writing shit ass php code that even some expierenced php users couldnt even understand. who probably havent even LOOKED for a reasoning behind the pluralization. instead they run to a mailing list to dig up the same fucking horses corpes that was beatin, mammed, and slaughtered not even a week ago. </tangent> @Ed Watkeys as i said earlier, what difference does this make? what does this have to do with the cpu? even if this option is enabled or disabled id imagine the plural forms of all phrases required are only computed ONCE! so this does NOTHING to your cpu, and takes up probably not even 1K of ram for even large applications. @AI Dev pluralization is 1: to make looking at things simpler ie: "more human like" 2: easier for many to understand later. @Legacy Databases who cares, even with pluralization off or on, i can guarentee your still probably going to be doing set_table_name and set_primary_key in half of your models! -- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Zachary, There is a difference between natural languages and artificial, domain specific languages. Precision, consistency, and conciseness are prized attributes of domain specific languages. Natural languages are not noted for being precise, consistent, and concise. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Rails'' pluralization rules are precise, consistent, and concise. They''re highly unobtrusive and make the code easier to immediately understand when reading (Do you spend more time writing or reading code? Which is more important? readability or writability? Do you ever even hear people talking about code writability?) Ok; that was offtopic, but which makes more sense? has_many :user or has_many :users how about -- belongs_to :users That one is downright confusing--does it belong to multiple users or one? Yuck. So we don''t want to belongs_to a plural or has_many a singular--that would suggest that we want plural and singular forms of model objects. Rails is pretty much completely consistent with English--if you''re referring to mulitple objects, use a plural, if one, use a singular. It''s really not that hard. I don''t remember *ever* having trouble with this, in fact finding it quite refreshing from the beginning. Inflection is one of the aspects that makes rails so pleasureable to use and I don''t think it''s going anywhere soon. Also: if you force the database schema into consistent terminology (person_id for foreign keys in the people table, etc.) then a maintainer coming back to the code years later will be immediately able to understand what''s going on because the rails rules are simple, obvious, and consistent enough. Yes, there''s something to be said for supporting legacy schemas, but if you haven''t noticed, that has never been a focus of rails. Brian On 8/19/05, Ed Watkeys <edw-tIV1OJqwIcc@public.gmane.org> wrote:> Zachary, > > There is a difference between natural languages and artificial, > domain specific languages. Precision, consistency, and conciseness > are prized attributes of domain specific languages. Natural languages > are not noted for being precise, consistent, and concise. > > Regards, > Ed > > -- > Transmogrify, LLC * <http://xmog.com/> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- The years ahead pick up their dark bags. They move closer. There''s a slight rise in the silence then nothing. -- (If you''re receiving this in response to mail sent to bluczkie-OM76b2Iv3yLQjUSlxSEPGw@public.gmane.org, don''t be concerned This is my new address, but mail will be forwarded here indefinitely)
On Aug 21, 2005, at 11:29 AM, Brian L. wrote:> Rails'' pluralization rules are precise, consistent, and concise. > They''re highly unobtrusive and make the code easier to immediately > understand when reading (Do you spend more time writing or reading > code? Which is more important? readability or writability? Do you ever > even hear people talking about code writability?)I hope you don''t actual believe what you''ve just written. If you don''t worry about code writability when you''re creating a language or a procedure or a framework, you''re not a very good programmer. Does it irritate when you find a Ruby method that should end with a question mark or exclamation point but doesn''t? It irritates me. Does it irritate you when you can''t guess a method name in PHP because the names of functions are named according to randomly-selected conventions? It irritates me. Does it irritate you when you don''t give classes certain names because you don''t know how the framework is going to pluralize them and don''t want to take the time to consult the magic list of special cases? It irritates me.> Ok; that was offtopic, but which makes more sense?There are at least three ways pluralization is used in Rails. Collection name pluralization in AR is nowhere near as bad as the table naming issue, because its effect doesn''t leak outside Rails. But it''s a good idea to explicitly state what relationship the collection represents, because it''s usually richer than the plural form of the class name on the other end of the relationship indicates. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
On Aug 21, 2005, at 10:10 AM, Ed Watkeys wrote:> On Aug 21, 2005, at 11:29 AM, Brian L. wrote: > >> Rails'' pluralization rules are precise, consistent, and concise. >> They''re highly unobtrusive and make the code easier to immediately >> understand when reading (Do you spend more time writing or reading >> code? Which is more important? readability or writability? Do you >> ever >> even hear people talking about code writability?) > > I hope you don''t actual believe what you''ve just written. If you > don''t worry about code writability when you''re creating a language > or a procedure or a framework, you''re not a very good programmer. > > Does it irritate when you find a Ruby method that should end with a > question mark or exclamation point but doesn''t? It irritates me. > Does it irritate you when you can''t guess a method name in PHP > because the names of functions are named according to randomly- > selected conventions? It irritates me. Does it irritate you when > you don''t give classes certain names because you don''t know how the > framework is going to pluralize them and don''t want to take the > time to consult the magic list of special cases? It irritates me. > >> Ok; that was offtopic, but which makes more sense? > > There are at least three ways pluralization is used in Rails. > Collection name pluralization in AR is nowhere near as bad as the > table naming issue, because its effect doesn''t leak outside Rails. > But it''s a good idea to explicitly state what relationship the > collection represents, because it''s usually richer than the plural > form of the class name on the other end of the relationship indicates. >Ed, we all appreciate that you have a very strong opinion on this matter. But please--do not presume that your _opinion_ is the only way the matter can be (or should be) viewed. Obviously, there are many, many of us who not only tolerate pluralization, but actually _like_ it. And no, that does not make us poor programmers. People can, and do, have different opinions, and different (valid!) approaches to software development. If you really hate pluralization in Rails, I suggest you work on a patch to Rails that makes it all behave like you would prefer. You can then submit that patch, and if it does not break existing apps and fits the Rails philosophy, it may find its way into the framework. Even if it doesn''t find its way into Rails itself, you can always fork the framework and tailor it for your own tastes and needs. No hard feelings at all, either way. - Jamis
On Sun, 2005-08-21 at 12:10 -0400, Ed Watkeys wrote:> On Aug 21, 2005, at 11:29 AM, Brian L. wrote: > > > Rails'' pluralization rules are precise, consistent, and concise. > > They''re highly unobtrusive and make the code easier to immediately > > understand when reading (Do you spend more time writing or reading > > code? Which is more important? readability or writability? Do you ever > > even hear people talking about code writability?)> > Ok; that was offtopic, but which makes more sense? > > There are at least three ways pluralization is used in Rails. > Collection name pluralization in AR is nowhere near as bad as the > table naming issue, because its effect doesn''t leak outside Rails. > But it''s a good idea to explicitly state what relationship the > collection represents, because it''s usually richer than the plural > form of the class name on the other end of the relationship indicates.I felt it made things easier when I had to explain details to a person with more formalized training and expectations. When doing a formal specification, he wanted to make objects of the lists and objects that where single instantiations. The pluralization helps define what is what. The plural table name matches up with the list of objects we needed to define. As well, we had the singular for the objects in the table. I only occasionally have trouble with pluralization when I am creating the objects/files. After it is created, programming with it is always easy. So occasionally I figure out I used the wrong form after running the generate script, but I have a list of the files it created and can go remove them. -- Steven Critchfield critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org KI4KTY
This halloween, I''m going to dress up like a "pluralized table names" thread. After all, they''re pretty scary, and they absolutely refuse to die. I''m not sure exactly what the costume will look like, but I think it''ll bear at least a faint resemblance to a dead horse. Tyler
> Ed, we all appreciate that you have a very strong opinion on this > matter. But please--do not presume that your _opinion_ is the only > way the matter can be (or should be) viewed. Obviously, there are > many, many of us who not only tolerate pluralization, but actually > _like_ it. And no, that does not make us poor programmers. People > can, and do, have different opinions, and different (valid!) > approaches to software development. If you really hate pluralization > in Rails, I suggest you work on a patch to Rails that makes it all > behave like you would prefer. You can then submit that patch, and if > it does not break existing apps and fits the Rails philosophy, it may > find its way into the framework.I''d suggest a patch that routes all pluralization through a single (or maybe a a bidirectional pair of ) singleton method somewhere in Rails. Then, if someone wants to turn off all pluralization (my preference), simply change redefine the method(s). That would mean a wopping 10 seconds of effort on each rails project. David
Ed Watkeys wrote:> Does it irritate you when you don''t give > classes certain names because you don''t know how the framework is going > to pluralize them and don''t want to take the time to consult the magic > list of special cases? It irritates me.If you are confused by pluralization, you have a lot of option. One is to disable them as has been discussed at length, both here and on several wiki page. Another is to learn the concept behind pluralization. Is class name plural? No, because a person is Person object, not a People object. Is collection plural? Yes, because it typically hold multiple instance. Is database table a kind of collection? Yes. If you put as much effort into either of the two option as you have this thread, you would have no trouble with pluralization.> But it''s a > good idea to explicitly state what relationship the collection > represents, because it''s usually richer than the plural form of the > class name on the other end of the relationship indicates.You ought to consider the default foreign key name sensible default. :foreign_key => and :class_name => exist to allow your table to be structured with clear meaning. In summary: Ruby on Rail already has support for disabling pluralization of table name for person who does not like it. Your judgement that pluralization increase complexity without gain is subjective and not held by many other. At this point, pluralization is a part of Rail and you must either learn how to configure and bend Rail to disable it, learn how to live with it, or use something else. Please let this thead lie. PS: In the interest of making this email more readable to you, I have avoided using plural where possible.
David Corbin wrote:> I''d suggest a patch that routes all pluralization through a single (or maybe a > a bidirectional pair of ) singleton method somewhere in Rails. Then, if > someone wants to turn off all pluralization (my preference), simply change > redefine the method(s). That would mean a wopping 10 seconds of effort on > each rails project.module ActiveSupport::Inflector def self.pluralize(name) name end end ??
For my 2pence worth, I think English as a natural language causes enough confusion on its own, mainly because of its ambiguity - but in humor this is a good thing because you can play on words. For a programming language, however, if I choose call an apple an apple, I want it to forever be seen as an apple. Calling it any thing other than that (plural or capitalised or what ever) breaks the principle of least surprise, in that the "system" has decided to call it something different. As for the proverbial dead horse, the reason it keeps coming back to be flogged is obviously because it is serious problem, and until it is solved it will keep coming back. Unless you have lots of garlic and holy water. Oh no, that''s vampires. -- Brad. On 21/08/05, Steven <critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org> wrote:> On Sun, 2005-08-21 at 12:10 -0400, Ed Watkeys wrote: > > On Aug 21, 2005, at 11:29 AM, Brian L. wrote: > > > > > Rails'' pluralization rules are precise, consistent, and concise. > > > They''re highly unobtrusive and make the code easier to immediately > > > understand when reading (Do you spend more time writing or reading > > > code? Which is more important? readability or writability? Do you ever > > > even hear people talking about code writability?) > > > > Ok; that was offtopic, but which makes more sense? > > > > There are at least three ways pluralization is used in Rails. > > Collection name pluralization in AR is nowhere near as bad as the > > table naming issue, because its effect doesn''t leak outside Rails. > > But it''s a good idea to explicitly state what relationship the > > collection represents, because it''s usually richer than the plural > > form of the class name on the other end of the relationship indicates. > > I felt it made things easier when I had to explain details to a person > with more formalized training and expectations. When doing a formal > specification, he wanted to make objects of the lists and objects that > where single instantiations. The pluralization helps define what is > what. The plural table name matches up with the list of objects we > needed to define. As well, we had the singular for the objects in the > table. > > I only occasionally have trouble with pluralization when I am creating > the objects/files. After it is created, programming with it is always > easy. So occasionally I figure out I used the wrong form after running > the generate script, but I have a list of the files it created and can > go remove them. > -- > Steven Critchfield > critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org > KI4KTY > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I have a question. If rails didn''t originally include pluralization (or its default was singular), would we be having this discussion? Most DBA types will emphasize (or demand) table names to be singular by matter of convention -- from their point of view, a plural table name is redundant as a table is always a collection of rows of data.>From (my personal) coding point of view, keeping everything singularis more consistent, albeit possibly a little more misleading: Users.list User.list_all If you want to argue the "english sounding" slant, consider this: when you read a SQL statement in your mind, do you think "pull all users" or "pull all rows from the user table"? Same result, subtly different though process. That''s where the great divide is I believe. I am honestly not trying to add flames to the fire. I''m just surprised that the initial creators of rails went down this path, as it is very subjective and goes against the grain a bit from conventions in other languages -- right or wrong doesn''t really matter. Having said that, I think changing the default to be singular is not a good idea at this point -- it''s too far along now. Having the option to disable it is A Good Thing, as it allows freedom (idiomatic ruby). Although I''ve had the idea of singular table names driven into my head by corporate IT, I will continue to use plural table names in my personal projects as this is, I believe, The Rails Way, good or bad. People tend to become comfortable with certain things and seem to resist change. Since most people starting with ruby have written apps in a different language which hit a db, they are accustomed to doing things a different way. Since the ruby language and rails framework is new to them, the db is the only portion which is remotely familiar. Apprehension ensues. On 8/22/05, Bradley Kite <bradley.kite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> For my 2pence worth, I think English as a natural language causes > enough confusion on its own, mainly because of its ambiguity - but in > humor this is > a good thing because you can play on words. > > For a programming language, however, if I choose call an apple an apple, > I want it to forever be seen as an apple. Calling it any thing other than > that (plural or capitalised or what ever) breaks the principle of > least surprise, > in that the "system" has decided to call it something different. > > As for the proverbial dead horse, the reason it keeps coming back to be flogged > is obviously because it is serious problem, and until it is solved it > will keep coming back. Unless you have lots of garlic and holy water. > Oh no, that''s vampires. > > -- > Brad. > > On 21/08/05, Steven <critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org> wrote: > > On Sun, 2005-08-21 at 12:10 -0400, Ed Watkeys wrote: > > > On Aug 21, 2005, at 11:29 AM, Brian L. wrote: > > > > > > > Rails'' pluralization rules are precise, consistent, and concise. > > > > They''re highly unobtrusive and make the code easier to immediately > > > > understand when reading (Do you spend more time writing or reading > > > > code? Which is more important? readability or writability? Do you ever > > > > even hear people talking about code writability?) > > > > > > Ok; that was offtopic, but which makes more sense? > > > > > > There are at least three ways pluralization is used in Rails. > > > Collection name pluralization in AR is nowhere near as bad as the > > > table naming issue, because its effect doesn''t leak outside Rails. > > > But it''s a good idea to explicitly state what relationship the > > > collection represents, because it''s usually richer than the plural > > > form of the class name on the other end of the relationship indicates. > > > > I felt it made things easier when I had to explain details to a person > > with more formalized training and expectations. When doing a formal > > specification, he wanted to make objects of the lists and objects that > > where single instantiations. The pluralization helps define what is > > what. The plural table name matches up with the list of objects we > > needed to define. As well, we had the singular for the objects in the > > table. > > > > I only occasionally have trouble with pluralization when I am creating > > the objects/files. After it is created, programming with it is always > > easy. So occasionally I figure out I used the wrong form after running > > the generate script, but I have a list of the files it created and can > > go remove them. > > -- > > Steven Critchfield > > critch-wQLwMjUOumVBDgjK7y7TUQ@public.gmane.org > > KI4KTY > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Brock Weaver [OBC]Technique
Nicholas Seckar wrote:> PS: In the interest of making this email more readable to you, I have > avoided using plural where possible.[sounds of a belly aching chuckle] Nicholas that was just too good. You made my morning.
Jamis Buck wrote:> Even if it doesn''t find its way into Rails itself, you can always fork > the framework and tailor it for your own tastes and needs. No hard > feelings at all, either way. > > - JamisWell spoken. From now on let''s just reply to troll messages with a one word response: LIDOGOFO LIDOGOFO (Let It Die Or Go Fork Off) (the source that is ;)
On Aug 25, 2005, at 7:44 AM, San wrote:> Jamis Buck wrote: > > >> Even if it doesn''t find its way into Rails itself, you can always >> fork the framework and tailor it for your own tastes and needs. >> No hard feelings at all, either way. >> - Jamis >> > > Well spoken. From now on let''s just reply to troll messages with a > one word response: LIDOGOFO > > LIDOGOFO (Let It Die Or Go Fork Off)Who is the troll? Do you know how to read date headers? A nice scab was forming over this thread. Until you came along. Ed -- Transmogrify, LLC * <http://xmog.com/>
10 Reasons Rails Does Pluralization: http://weblog.rubyonrails.org/archives/2005/08/25/10-reasons-rails-does-pluralization -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework
Dude, I *love* you <wide grin> You totally rock. AND you''re cool and funny too. Wow :-) LOL. Julian. On 25/08/2005, at 10:10 PM, David Heinemeier Hansson wrote:> 10 Reasons Rails Does Pluralization: > http://weblog.rubyonrails.org/archives/2005/08/25/10-reasons-rails- > does-pluralization > -- > David Heinemeier Hansson_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> Dude, I *love* you <wide grin> You totally rock. AND you''re cool and funny > too. Wow :-) LOL.As long as your follow up question is not for my phone number, we''re cool ;) -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework
Just out of curiosity (and we all know it killed the cat - and that *is* my chinese star sign)... What is your native language, Nicholas? You missed the -s off a few singular verb forms. For instance: "Your judgement that pluralization increase complexity". I''m quite aware that you tried to singularize where possible, but ironically you''ve used the plural verb form ;-) Just being the über-grammatically-pedantic silly bugger that I am :-) Hope you don''t care too much and if you''d really REALLY like this thread to die, that you won''t respond. <awaits response> While I''m waiting, I just have to say ... RAILS ROCKS! <w00t!> From Julian. On 22/08/2005, at 5:05 AM, Nicholas Seckar wrote:> If you are confused by pluralization, you have a lot of option. One > is to disable them as has been discussed at length, both here and > on several wiki page.... and a whole bunch more stuff.
On Aug 29, 2005, at 8:04 AM, Julian Leviston wrote:> Just out of curiosity (and we all know it killed the cat - and that > *is* my chinese star sign)... What is your native language, Nicholas? > You missed the -s off a few singular verb forms. For instance: > "Your judgement that pluralization increase complexity". > I''m quite aware that you tried to singularize where possible, but > ironically you''ve used the plural verb form ;-) > Just being the über-grammatically-pedantic silly bugger that I > am :-) Hope you don''t care too much and if you''d really REALLY like > this thread to die, that you won''t respond.Yes, I didn''t know which parts of his post were designed to elicit forced laughs from his groupies and which were symptomatic of his illiteracy. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Ed Watkeys wrote:> Yes, I didn''t know which parts of his post were designed to elicit > forced laughs from his groupies and which were symptomatic of his > illiteracy.English isn''t my first language ASSHOLE. Thanks for being an ignorant dick. Have a nice day.
RE: DHH''s "10 reasons" blog entry Aside from being genuinely amused by his comedic "reasons", I find it interesting that the 10 reasons is actually 1 reason and 9 jokes. "Beautiful code leads to happy programmers: One of my prime inspirations for still doing programming is the possibility of creating beautiful code. I consider the singular/plural splits as employeed in Rails to constitute beauty. Removing it would make Rails appear less beautiful and that would make me sad." That''s the only actual argument FOR the system. And since that''s a preference argument, we can expect to see many who disagree with that preference (myself included). If I had to write a blunt summary guess of why the pluralization system is in Rails, it would be "because the small group of creators thought it was a neat idea, and they liked the way it made code read." This whole thing reminds me of the whitespace/indention rules of Python.
> Aside from being genuinely amused by his comedic "reasons", I find it > interesting that the 10 reasons is actually 1 reason and 9 jokes.Rails is opinionated software. Deal with that. Regards, Tomas
> If I had to write a blunt summary guess of why the pluralization > system is in Rails, it would be "because the small group of creators > thought it was a neat idea, and they liked the way it made code read."Do note that the entire framework is created according to this directive. Rails is personal software more than anything. It''s the software that I like to use, written how I like to read it. As touched upon in other places, it''s opinionated software. So please. Let this permathread rest. Do make patches for bugs you should encounter trying to turn pluralization off (I believe the most common one is with the scaffolding generator), but let the argument of whether its going to be turned off by default die. It''s not. And let''s increase the civil tone. The flamefest cleansing should have been completed for this season. -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework