[Twisted-Python] coding standard: plurals for database table names
Steve Waterbury
golux at comcast.net
Sun Apr 6 14:26:13 EDT 2003
On Sun, 2003-04-06 at 13:53, Clark C. Evans wrote:
> I noticed in the Twisted Coding Standard that...
>
> "Database tables shall be named with plural nouns"
>
> I'd like to question this standard for several reasons:
> [ some trimming for brevity ]
>
> 3. It is helpful to name foreign key columns as the
> same name as the table that they are coming from.
What if you have more than one foreign key to the same
table? A very simple example (from my app ;^): the
attributes "owner", "creator", and "modifier" all point
to the "persons" table. As a rule of thumb, it's usually
best to name the foreign key column after the role that
the foreign key entity plays in the referring table.
> 5. While there are astechic reasons for this (above)
> the resons become all the more important when
> you want to build automatic tools for searching
> over schemata, etc. In this case, using plurals
> only adds one extra (unnecessary) step in the
> automated translation of plural table names to
> singluar column and or class names.
I didn't think it was all that difficult. I can send you
the O-R mapping I use, if you like.
> In short, I'd recommend singluar nouns, with M-M
> link tables as one__two where one and two are
> tables being linked to.
One could reasonably argue that it is not important to have
a table-naming rule in the coding standard. I don't really
care either way, but I happen to like using plural names for
tables, and I'll use it regardless of what the Twisted coding std
says anyhow, because I use my own O-R mapping instead of t.e.row
(mine is different from t.e.row in many ways, but it does map plural
table names to singular object names ;^).
Cheers,
- Steve.
More information about the Twisted-Python
mailing list