NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
__ (Score:1)
Tables vs Classes (Score:2)
I don't get the connection between table names and class names.
The english word class (in its generic non-CS use) derives from the same root as 'classification'. Dictionary definitions for class use words like 'a collection of things sharing a common attribute', 'A group of individuals ranked together as possessing common characteristics'. In this respect, a class is a collection in the same way that a table is.
I agree 100% that class names should usually be singular. It seems obvious to me that the same logic behind that decision applies in exactly the same way
foot vs. feet (Score:1)
head vs. heads: simple
foot vs. feet: not as simple
Here, no generalized form is possible, thus it can't be done without explicit naming.
That of course costs time as you need to think about it every time you encounter it, especially if your mother tongue isn't english.
but common use cases differ... (Score:1)
rjbs
Re: (Score:2)
In SQL, the minimum likely use case is:
And each row you get back is made up of those attributes of a 'character'. Sure you get multiple rows, but I don't get how that's different from defining a class in order to instantiate multiple objects.
With a class, the minimum likely use case is:
A common case in Rails is:
Which ultimately generates SQL along the lines of:
And the application will then instantiate one Character object for each row retrieved from the table. In this case there is a clear and deliberate one-to-
one more thing (Score:1)
Plural bad! (Score:2)
Another problem is that it degrades badly when you have "linking" tables. Say I have Accounts and Users, then I might have an AccountsUsers table. Yuck! If I have Accounts, Users, and Roles, th
Re: (Score:2)
The proposed standard naming convention from $cow_orker also mandated the use of CamelCase. With the added wrinkle of a short suffix on every table name. E.g.: Account_act or ProductCommissionGroup_pcg. Any advance on Triple-Yuck ?
Re: (Score:1)
Re: (Score:2)
That suffix thing is truly awful, though. What possible purpose could it serve? It's like naming everything twice.
Re: (Score:2)
Re: (Score:1)
This is why I prefer using _ instead.
For the record, note that my job involves a lot of reporting. I spend more time writing SQL than Perl.
Re: (Score:1)
Yeah, except for a particular free-of-charge database that seems to be quite popular. Tables are files on the underlaying filesystem, and if the underlaying filesystem is case sensitive, your tables are as well. Columns, OTOH, aren't case-sensitive.
Re: (Score:1)
...and a certain well-known commercial database (*cough* Sybase *cough*). There is a global switch you (i.e. the DBA) can flip to change that, but then all havok breaks loose...