Table names, singular or plural |
[eluser]ipsod[/eluser]
I prefer singular for simplicity's sake, but use plural because that's the standard with DMZ.
[eluser]snifty[/eluser]
This is an interesting question, old though it may be. Various plugins and libraries seem to have different ideas about this. For instance, Phil's base model expects singular table names: https://github.com/philsturgeon/codeigniter-base-model ...although it supports alternatives. As ipsod describes, Datamapper wants plural table names: http://stensi.com/datamapper/pages/models.html I guess there's no way to standardize so that such packages can work together without hacking
[eluser]TWP Marketing[/eluser]
I use both, depending on the content or intended usage of the table, ie; 'control' would have a single (or at most a few) records. 'users' would have multiple records. 'admin' usually a single intended usage (could have multiple records but intent is administration). 'customers' multiple unique records. Also, the singular/plural usage is language and culture dependent. I'm just glad there is no "required" format for table names. But the Federal Bureau of Coders (FBC) may have other ideas... (joke, but watch your six.)
[eluser]snifty[/eluser]
Yeah, I guess I agree with you. It can be a pain to rename everything, which is what I'm facing. Time to start a branch in Git & see what breaks after I start renaming! I should really learn to unit test too But I suppose it's better not to have the whole framework demanding one convention over the other. What's "my six"?
[eluser]John_Betong_002[/eluser]
Off topic: Quote:Yes, it means there is danger behind you. It comes from the military, I think.It was news to me and I Googled for the above.
[eluser]TWP Marketing[/eluser]
@John_Betong: Thanks for the clarification of my joke. I should have known 'six' would not be common usage outside the US. Yes, I meant that we, as programmers/coders, should beware of those who would try to enforce arbitrary standards on our work. I fear that we will see an 'FBC' created sometime in the future, if it doesn't exist already. The names of some large companies come to mind... (not joking). And thanks for the link to the php_variables_test table! I've bookmarked it. Also, since I haven't used DMZ, I did not realise that it enforces the use of singular and plural names between tables and models. Personally, I would not have forced the names to be different, it seems a lot of effort to make the human language syntax work. No offence intended, DMZ is an excellent tool! If there is another reason for that particular naming convention, I'd appreciate hearing it.
[eluser]snifty[/eluser]
I'll have to add "watch your six" to my vocabulary. ;-) Anyway, I'm still struggling to get all this plural/singular stuff worked out in my app. Hopefully I cna get it back in working order and the base model I want to use running.
[eluser]cahva[/eluser]
And with datamapper, you actually can use both(or whatever) if you want. Its just a matter of defining the table name in the model(eg. var $table = 'user'; ). Watch your six was known to me(Im from Finland) but I watch too much hollywood movies anyways |
Welcome Guest, Not a member yet? Register Sign In |