Frustration
-
Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.
string MyName => SomeOtherName;
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Having worked on a system that used some of Jeremy's mapping alternatives I recommend that you NEVER do this, attempting to track through from a field name on a form/class that is different to the column name in the database is a nightmare. You would be just adding complexity for the sake of it, adding multiples to the support cost and the supporting dev will have a wax effigy of you and be sticking needles in it!
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
Mycroft Holmes wrote:
Having worked on a system that used some of Jeremy's mapping alternatives I recommend that you NEVER do this
I'm trying to collect $20 though...
Jeremy Falcon
-
Having worked on a system that used some of Jeremy's mapping alternatives I recommend that you NEVER do this, attempting to track through from a field name on a form/class that is different to the column name in the database is a nightmare. You would be just adding complexity for the sake of it, adding multiples to the support cost and the supporting dev will have a wax effigy of you and be sticking needles in it!
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
I have frequently seen that kind of arguments, and very similar ones, used to justify that end user with a vague idea about the meaning of English terms nevertheless have to accept them, because those are their real names, and using anything else would be confusing and misleading. It would be fascinating if Chinese hardware and software developer switched to a similar approach.
-
I have frequently seen that kind of arguments, and very similar ones, used to justify that end user with a vague idea about the meaning of English terms nevertheless have to accept them, because those are their real names, and using anything else would be confusing and misleading. It would be fascinating if Chinese hardware and software developer switched to a similar approach.
More of a guideline really.
-
Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.
Don't worry, it's just a temporary thing. Next migration will change the database column names and (dis)order will be restored in universe. ;P
Mircea
-
I have frequently seen that kind of arguments, and very similar ones, used to justify that end user with a vague idea about the meaning of English terms nevertheless have to accept them, because those are their real names, and using anything else would be confusing and misleading. It would be fascinating if Chinese hardware and software developer switched to a similar approach.
-
Having worked on a system that used some of Jeremy's mapping alternatives I recommend that you NEVER do this, attempting to track through from a field name on a form/class that is different to the column name in the database is a nightmare. You would be just adding complexity for the sake of it, adding multiples to the support cost and the supporting dev will have a wax effigy of you and be sticking needles in it!
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
What's so hard about COL1, COL2, COL3? /s
Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
-
It sort of like calling people by another name, that is not theirs. "Hey Bob, how are you today?" "I'm not Bob, I'm Charlie!" "Who's Charlie? You must mean Debra. Wait right here, I'll get her/she/they/them." :laugh:
-
Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.
So, I smiled when I read this, thinking of the because it's easy and makes sense answer. But really, this is a deeper question that depends on what language you are using and what the application interaction with the user is. I'm assuming you're comparing local variable names to the DB columns; and not accessing the actual DB object. There are cases where this may not be best practice and maybe a case could be made to argue it is not best practice at all.
-
Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.
I assume you're not using an ORM? All the ORM's I've used (EF, Linq2SQL, Dapper, etc) have the ability to attribute the model with table and column aliases.
Latest Article:
Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain -
Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.
-
I assume you're not using an ORM? All the ORM's I've used (EF, Linq2SQL, Dapper, etc) have the ability to attribute the model with table and column aliases.
Latest Article:
Create a Digital Ocean Droplet for .NET Core Web API with a real SSL Certificate on a Domain -
What's so hard about COL1, COL2, COL3? /s
Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
As punishment for that you get sent to Q&A for a week!
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
-
As punishment for that you get sent to Q&A for a week!
Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP
If they ask for codez now I'll use those variable names! :laugh: :laugh: :laugh: I'm pretty certain I saw something like those in a BPCS system once... :sigh: I'm still trying to erase that memory.
Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
-
Job insurance. ;P
Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver
-
It sort of like calling people by another name, that is not theirs. "Hey Bob, how are you today?" "I'm not Bob, I'm Charlie!" "Who's Charlie? You must mean Debra. Wait right here, I'll get her/she/they/them." :laugh:
People do that all the time though :~ My grandma's are both named Elisabeth something something on their birth certificate/passport, but we call them Bep (quite a common name here for old people). I recently found out Dick is a nickname for Richard, Bill for William and Bob for Robert. A lot of people have birth names that are different from the names we actually call them (sometimes the names are at least related, but often they're not). And when a woman marries a man she suddenly gets a new last name (and is proud of it too). Luckily, all of these are getting more rare X| My complete name is simply Sander Rossel and that's what people call me too :D
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
Because the people that once designed the database gave their columns names like cicmpy (customer info company, or something like that, taken from a very popular financial system). Or because you're dealing with TextField1, TextField2,... TextField20, DateField1, DateField2,... DateField20, etc. "because the software should be flexible." (I have to admit, the software is flexible and works miraculously well, but their API is horrible).
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
-
People do that all the time though :~ My grandma's are both named Elisabeth something something on their birth certificate/passport, but we call them Bep (quite a common name here for old people). I recently found out Dick is a nickname for Richard, Bill for William and Bob for Robert. A lot of people have birth names that are different from the names we actually call them (sometimes the names are at least related, but often they're not). And when a woman marries a man she suddenly gets a new last name (and is proud of it too). Luckily, all of these are getting more rare X| My complete name is simply Sander Rossel and that's what people call me too :D
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript
Use of nicknames vary greatly from one culture / country to another. Here in Norway 99% of the population are called by their 'real' names - to the degree that Bill Bryson (yes, yet another Bryson quote!) tells in "Neither here nor there": "I had had huge difficulty persuading the staff at the Kredittkassen Bank on Karl Johans Gate to cash sufficient traveller's checques to pay the extortionate 1,200 kroner bus fare - they simply could not made to grasp that the William McGuire Bryson on my passport and the Bill Bryson on my traveller's cheques were both me" I've seen it from the other side as well: Don't expect every Norwegian to have a middle name. Today, it is seen more often, but in my generation, I hardly know of anyone with a middle name. I wanted some information from a USA web site that required me to create a user, asking for my real name, and they insisted on a "middle initial". American forms for specifying names almost invariably has a field for the middle initial, but you may leave it open. Not on this website, it insisted on an alphabetic character, A-Z. Space, hyphen or other punctuation marks were not accepted, you had to reveal your middle initial. Of course you have one - everybody have a middle initial! Sure, I don't think I've ever met anyone from the USA without a middle initial. We do use double first names: My best buddy in childhood was named Per Erik, one of my current friends is named Per-Kristian, my father was named Torleif (Tor Leif, but as one, unhyphenated word). The double name is always used in full: If you asked me when I was ten if I knew of any 'Per', Per Erik would never occur to me. Per-Kristian is not some 'Per' that I know today. If you suggest that my father was named Tor, I would protest; that is simply wrong. In my parents' generation, it was more common to have a double, unhyphenated first name, but use only one of them in everyday life. I knew my mother's other first name, but didn't know until several years after moving out from my parents' that my father had a another first name! They would never indicate the initial letter of the other first name as a "middle initial" - the other name is still a first name, not a middle name! The same goes for lots of other people of that generation that I know. I guess that one reason why we rarely use nicknames is that the major part of Norwegian first names are short, 1 or 2 syllables. All the 4-syllable names I can think of are really two concatenated names. Most, but not all, 3-syllable names are
-
0x01AA wrote:
But why one should use different names?
Certainly one reason is that databases have absolute length limits. So if you exceed that you are out of luck. As an example the Oracle column name length limit is 30. Additionally when database statements are constructed there are length limits on the total length of that. One of course should not normally run into that. Which is perhaps worse because what happens is that someone uses magical coding APIs without understanding what is actually happening and then when it fails for that one odd ball case then no one can figure out what is happening. Then there are things that happen over time. Such as a table that has a column named 'total' which even though the column is still named that, what is actually is now is the 'DailyTotal'. Column might be used in one place where in the code the attribute 'DailyTotal' is used in many places. So explaining what it actually is in every place becomes a problem.
-
Use of nicknames vary greatly from one culture / country to another. Here in Norway 99% of the population are called by their 'real' names - to the degree that Bill Bryson (yes, yet another Bryson quote!) tells in "Neither here nor there": "I had had huge difficulty persuading the staff at the Kredittkassen Bank on Karl Johans Gate to cash sufficient traveller's checques to pay the extortionate 1,200 kroner bus fare - they simply could not made to grasp that the William McGuire Bryson on my passport and the Bill Bryson on my traveller's cheques were both me" I've seen it from the other side as well: Don't expect every Norwegian to have a middle name. Today, it is seen more often, but in my generation, I hardly know of anyone with a middle name. I wanted some information from a USA web site that required me to create a user, asking for my real name, and they insisted on a "middle initial". American forms for specifying names almost invariably has a field for the middle initial, but you may leave it open. Not on this website, it insisted on an alphabetic character, A-Z. Space, hyphen or other punctuation marks were not accepted, you had to reveal your middle initial. Of course you have one - everybody have a middle initial! Sure, I don't think I've ever met anyone from the USA without a middle initial. We do use double first names: My best buddy in childhood was named Per Erik, one of my current friends is named Per-Kristian, my father was named Torleif (Tor Leif, but as one, unhyphenated word). The double name is always used in full: If you asked me when I was ten if I knew of any 'Per', Per Erik would never occur to me. Per-Kristian is not some 'Per' that I know today. If you suggest that my father was named Tor, I would protest; that is simply wrong. In my parents' generation, it was more common to have a double, unhyphenated first name, but use only one of them in everyday life. I knew my mother's other first name, but didn't know until several years after moving out from my parents' that my father had a another first name! They would never indicate the initial letter of the other first name as a "middle initial" - the other name is still a first name, not a middle name! The same goes for lots of other people of that generation that I know. I guess that one reason why we rarely use nicknames is that the major part of Norwegian first names are short, 1 or 2 syllables. All the 4-syllable names I can think of are really two concatenated names. Most, but not all, 3-syllable names are
Mandatory middle name? :~ An ex-coworker had a girlfriend from Indonesia, and where she's from they simply don't have a last name... Apparently, it's legal in the Netherlands to not have a last name as long as you don't have the Dutch nationality. As soon as you get Dutch nationality you need to pick a last name. Anyway, she didn't have a last name officially, but for most forms she had to use her made up last name (which was official-ish, I guess). What's more, they got a child, and a first child can have the last name of the mother or the father. Most pick father, but they picked mother, so the child doesn't have a last name either. I believe (s)he(?) gets to pick both his nationality and last name when (s)he turns 18.
Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript