User:Philip/Schmierzettel
From AdminWiki
Line 1: | Line 1: | ||
+ | von http://stackoverflow.com/questions/218123/what-was-the-strangest-coding-standard-rule-that-you-were-forced-to-follow#220101 | ||
+ | |||
+ | auch: http://www.joelonsoftware.com/articles/Wrong.html | ||
+ | |||
My weirdest one was at a contract a couple years ago. @ZombieSheep's weird one was part of it, but not the weirdest one in that company. | My weirdest one was at a contract a couple years ago. @ZombieSheep's weird one was part of it, but not the weirdest one in that company. | ||
Latest revision as of 21:35, 23 April 2009
auch: http://www.joelonsoftware.com/articles/Wrong.html
My weirdest one was at a contract a couple years ago. @ZombieSheep's weird one was part of it, but not the weirdest one in that company.
No, the weirdest one in that company was the database naming scheme. Every table was named in all caps, with underscores between the words. Every table had a prefix (generally 1 - 6 characters) which was usually an acronym or an abbreviation of the main table name. Every field of the table was prefixed with the same prefix as well. So, let's say you have a simple schema where people can own cats or dogs. It'd look like this:
PER_PERSON
PER_ID PER_NameFirst PER_NameLast ...
CAT_CAT
CAT_ID CAT_Name CAT_Breed ...
DOG_DOG
DOG_ID DOG_Name DOG_Breed ...
PERCD_PERSON_CAT_DOG (for the join data)
PERCD_ID PERCD_PER_ID PERCD_CAT_ID PERCD_DOG_ID
That said, as weird as this felt initially ... It grew on me. The reasons behind it made sense (after you wrapped your brain around it), as the prefixes were there to be reminders of "recommended" (and enforced!) table aliases when building joins. The prefixing made the majority of join queries easier to write, as it was very rare that you'd have to explicitly reference a table before the field.
Heck, after a while, all of us on the team (6 people on our project) were able to begin referring to tables in conversation by nothing more than the prefix. An acquired taste, to be sure ... But one that grew on me. So much so that I still use it, when I have that freedom.