Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Frustration

Frustration

Scheduled Pinned Locked Moved The Lounge
questiondatabaseregex
37 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M MadGerbil

    Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #3

    And if this was a joke on the programming question issue.... mad respect. That was quite nice. :laugh:

    Jeremy Falcon

    1 Reply Last reply
    0
    • M MadGerbil

      Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

      0 Offline
      0 Offline
      0x01AA
      wrote on last edited by
      #4

      Because it makes sense. What reason, to have the name 'X' in database and in the code it is 'Y'.... If you like that, happy confusion in the future ;)

      S 1 Reply Last reply
      0
      • 0 0x01AA

        Because it makes sense. What reason, to have the name 'X' in database and in the code it is 'Y'.... If you like that, happy confusion in the future ;)

        S Offline
        S Offline
        Slacker007
        wrote on last edited by
        #5

        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:

        C Sander RosselS 2 Replies Last reply
        0
        • M MadGerbil

          Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #6

          You use column names in your code?

          1 Reply Last reply
          0
          • M MadGerbil

            Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #7

            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

            J T D 3 Replies Last reply
            0
            • M MadGerbil

              Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #8

              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

              1 Reply Last reply
              0
              • M Mycroft Holmes

                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

                J Offline
                J Offline
                Jeremy Falcon
                wrote on last edited by
                #9

                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

                1 Reply Last reply
                0
                • M Mycroft Holmes

                  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

                  T Offline
                  T Offline
                  trønderen
                  wrote on last edited by
                  #10

                  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.

                  P J 2 Replies Last reply
                  0
                  • T trønderen

                    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.

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #11

                    More of a guideline really.

                    1 Reply Last reply
                    0
                    • M MadGerbil

                      Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

                      M Offline
                      M Offline
                      Mircea Neacsu
                      wrote on last edited by
                      #12

                      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

                      1 Reply Last reply
                      0
                      • T trønderen

                        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.

                        J Offline
                        J Offline
                        jmaida
                        wrote on last edited by
                        #13

                        LOL

                        "A little time, a little trouble, your better day" Badfinger

                        1 Reply Last reply
                        0
                        • M Mycroft Holmes

                          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

                          D Offline
                          D Offline
                          David ONeil
                          wrote on last edited by
                          #14

                          What's so hard about COL1, COL2, COL3? /s

                          Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                          M J 2 Replies Last reply
                          0
                          • S Slacker007

                            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:

                            C Offline
                            C Offline
                            charlieg
                            wrote on last edited by
                            #15

                            Keep me out of this :)

                            Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                            1 Reply Last reply
                            0
                            • M MadGerbil

                              Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

                              M Offline
                              M Offline
                              MikeCO10
                              wrote on last edited by
                              #16

                              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.

                              1 Reply Last reply
                              0
                              • M MadGerbil

                                Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #17

                                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

                                0 1 Reply Last reply
                                0
                                • M MadGerbil

                                  Why does the column name in my code have to match the column name in the database? It just feels so.... restrictive.

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #18

                                  Prefix tables with "tbl" and your code be happy.

                                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                  1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    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

                                    0 Offline
                                    0 Offline
                                    0x01AA
                                    wrote on last edited by
                                    #19

                                    But why one should use different names? Is it not only make the things more confusing?

                                    D Sander RosselS J 3 Replies Last reply
                                    0
                                    • D David ONeil

                                      What's so hard about COL1, COL2, COL3? /s

                                      Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                                      M Offline
                                      M Offline
                                      Mycroft Holmes
                                      wrote on last edited by
                                      #20

                                      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

                                      D 1 Reply Last reply
                                      0
                                      • M Mycroft Holmes

                                        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

                                        D Offline
                                        D Offline
                                        David ONeil
                                        wrote on last edited by
                                        #21

                                        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

                                        1 Reply Last reply
                                        0
                                        • 0 0x01AA

                                          But why one should use different names? Is it not only make the things more confusing?

                                          D Offline
                                          D Offline
                                          David ONeil
                                          wrote on last edited by
                                          #22

                                          Job insurance. ;P

                                          Our Forgotten Astronomy | Object Oriented Programming with C++ | Wordle solver

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups