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. Code First, do you like it?

Code First, do you like it?

Scheduled Pinned Locked Moved The Lounge
databasequestion
75 Posts 42 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.
  • S Slacker007

    We are thinking about moving from database first, to code first, with our new projects.

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

    I wouldn't know how to normalize a code-first model :)

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

    S 1 Reply Last reply
    0
    • V Vark111

      Neither. I prefer to hand create both. Call me old school, but I don't trust auto created databases or entity layers. Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #11

      Vark111 wrote:

      I don't trust auto created databases or entity layers.

      :thumbsup:

      There are only 10 types of people in the world, those who understand binary and those who don't.

      1 Reply Last reply
      0
      • S Slacker007

        We are thinking about moving from database first, to code first, with our new projects.

        H Offline
        H Offline
        HobbyProggy
        wrote on last edited by
        #12

        For my limited experience, what i can tell either way you got to adjust the side you started first. Even with a virtual Database you'll reach the point where you just transferred it and finished the db, then someone is asking for another field. Or at what point you say the app is ready and you can start to set up the Database? I started DB first, adjusted the programm, then the db, then both and so on. Seems like somethings never "finish".

        Rules for the FOSW ![^]

        if(this.signature != "")
        {
        MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
        }
        else
        {
        MessageBox.Show("404-Signature not found");
        }

        1 Reply Last reply
        0
        • R RUs123

          Depends..if someone stops me on the way back to my desk before I had my coffee, I may have to drink a bit of it before I answer their question. :-D

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

          If you ever meet me: You won't like me before I had three mugs of strong coffee that day. Just see my signature.. :)

          Get me coffee and no one gets hurt!

          S R 2 Replies Last reply
          0
          • S Slacker007

            We are thinking about moving from database first, to code first, with our new projects.

            A Offline
            A Offline
            Amarnath S
            wrote on last edited by
            #14

            Spec First, before any of these :-)

            S 1 Reply Last reply
            0
            • V Vark111

              Neither. I prefer to hand create both. Call me old school, but I don't trust auto created databases or entity layers. Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

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

              Vark111 wrote:

              Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

              I have read, and heard, many stories about this. It is one of our concerns.

              G L 2 Replies Last reply
              0
              • S Slacker007

                We are thinking about moving from database first, to code first, with our new projects.

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

                Programmers rarely think correctly in terms of relationships between objects when they do code first. They're usually thinking in terms of denormalized data. Certainly, I do, because it's the denormalized data that I usually want to display to the user. So, that's the first problem with code first. Programmers are typically not very good at figuring out normalization and the nuances of left joins, right joins, one-to-many and many-to-many relationships, at least as to how you'd implement them in a DB. Sure, the code first stuff *should* be able to generate the lookup tables if you define the relationship ordinality correctly, but as others have written, I'd rather have direct control. Even DB people make a mess of relationships. Lastly, there's a weird reality that I can define a decent normalized database, but when I go to use it in the code, I realize that I screwed up understanding some relationship that I thought I understood when creating the DB, but I realize I got wrong when I go actually trying to use it based on the requirements. It's weird that that can happen, but it does, at least in my experience. [tldr:] Neither code first nor database first is the correct approach. It needs to be "code and database together." And code first does NOT get you there. Marc

                Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

                S 1 Reply Last reply
                0
                • L Lost User

                  I wouldn't know how to normalize a code-first model :)

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

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

                  Just saw a demo online a few days ago, and the "demo guys" were having trouble with some areas with code first, and they were the "experts". So far, I am not entirely convinced that it is a development strategy worth using for the long term. We shall see, I guess.

                  L S 2 Replies Last reply
                  0
                  • S Slacker007

                    We are thinking about moving from database first, to code first, with our new projects.

                    F Offline
                    F Offline
                    Foothill
                    wrote on last edited by
                    #18

                    For me, it depends on database use. If the database is going to be highly transactional, I would start with the database as the Entity framework won't optimize table structures and indexes like building it by hand would. If it is just a data store, then start with the app first so you can focus on the presentation layer.

                    if (Object.DividedByZero == true) { Universe.Implode(); }

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      Programmers rarely think correctly in terms of relationships between objects when they do code first. They're usually thinking in terms of denormalized data. Certainly, I do, because it's the denormalized data that I usually want to display to the user. So, that's the first problem with code first. Programmers are typically not very good at figuring out normalization and the nuances of left joins, right joins, one-to-many and many-to-many relationships, at least as to how you'd implement them in a DB. Sure, the code first stuff *should* be able to generate the lookup tables if you define the relationship ordinality correctly, but as others have written, I'd rather have direct control. Even DB people make a mess of relationships. Lastly, there's a weird reality that I can define a decent normalized database, but when I go to use it in the code, I realize that I screwed up understanding some relationship that I thought I understood when creating the DB, but I realize I got wrong when I go actually trying to use it based on the requirements. It's weird that that can happen, but it does, at least in my experience. [tldr:] Neither code first nor database first is the correct approach. It needs to be "code and database together." And code first does NOT get you there. Marc

                      Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

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

                      Thanks for your feedback. I appreciate it. :thumbsup:

                      1 Reply Last reply
                      0
                      • L Lost User

                        If you ever meet me: You won't like me before I had three mugs of strong coffee that day. Just see my signature.. :)

                        Get me coffee and no one gets hurt!

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

                        Light roast (mild flavor), has more caffeine than manly, dark roast. Just saying. :-D Although, I prefer the flavor of a medium roast to a Sumatra, etc..

                        F 1 Reply Last reply
                        0
                        • S Slacker007

                          Just saw a demo online a few days ago, and the "demo guys" were having trouble with some areas with code first, and they were the "experts". So far, I am not entirely convinced that it is a development strategy worth using for the long term. We shall see, I guess.

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

                          Slacker007 wrote:

                          Just saw a demo online a few days ago

                          Still got the link?

                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                          S 1 Reply Last reply
                          0
                          • V Vark111

                            Neither. I prefer to hand create both. Call me old school, but I don't trust auto created databases or entity layers. Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

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

                            I agree :thumbsup:

                            1 Reply Last reply
                            0
                            • S Slacker007

                              We are thinking about moving from database first, to code first, with our new projects.

                              T Offline
                              T Offline
                              Tom Deketelaere
                              wrote on last edited by
                              #23

                              Never liked the code first approach. I'm currently working on a project where it used to be code first, so the database was created by code. (due to external factors we now have database first, but that's to long to explain) Whoever did it messed up royally. - Many to many relationships where there should be one to many. - Tables that just don't make sense. - Overly complicated structures. - Datatypes that just don't make sense. - Missing foreign keys. - ... It's a major pain to work with it now (even with database first) due to those things, unfortunately the database can't be changed anymore so I'm stuck with it (some things I can still fix but most I can't, not without rewriting a major part off the code). About 30% of the tables in that db shouldn't even exist so... If you'r going code first make sure you have a good handle on it because if done wrong it can be a nightmare to work with.

                              Tom

                              S 1 Reply Last reply
                              0
                              • S Slacker007

                                We are thinking about moving from database first, to code first, with our new projects.

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

                                that will be 5 concurrent users before the crash.

                                it ain’t broke, it doesn’t have enough features yet.

                                1 Reply Last reply
                                0
                                • A Amarnath S

                                  Spec First, before any of these :-)

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

                                  Avijnata wrote:

                                  Spec First

                                  That goes without saying.

                                  A 1 Reply Last reply
                                  0
                                  • V Vark111

                                    Neither. I prefer to hand create both. Call me old school, but I don't trust auto created databases or entity layers. Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

                                    J Offline
                                    J Offline
                                    jgakenhe
                                    wrote on last edited by
                                    #26

                                    Thank you. I have not tried it yet and its nice to hear not everyone is jumping on the bandwagon. Using a wizard to create your database just sounds like trouble.

                                    1 Reply Last reply
                                    0
                                    • T Tom Deketelaere

                                      Never liked the code first approach. I'm currently working on a project where it used to be code first, so the database was created by code. (due to external factors we now have database first, but that's to long to explain) Whoever did it messed up royally. - Many to many relationships where there should be one to many. - Tables that just don't make sense. - Overly complicated structures. - Datatypes that just don't make sense. - Missing foreign keys. - ... It's a major pain to work with it now (even with database first) due to those things, unfortunately the database can't be changed anymore so I'm stuck with it (some things I can still fix but most I can't, not without rewriting a major part off the code). About 30% of the tables in that db shouldn't even exist so... If you'r going code first make sure you have a good handle on it because if done wrong it can be a nightmare to work with.

                                      Tom

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

                                      Tom Deketelaere wrote:

                                      If you'r going code first make sure you have a good handle on it because if done wrong it can be a nightmare to work with.

                                      This is a real concern for us, as well. Thanks for the feedback.

                                      1 Reply Last reply
                                      0
                                      • V Vark111

                                        Neither. I prefer to hand create both. Call me old school, but I don't trust auto created databases or entity layers. Too many times someone makes a "minor" tweak to one or the other and then forgets to regenerate, then you're hosed.

                                        G Offline
                                        G Offline
                                        GuyThiebaut
                                        wrote on last edited by
                                        #28

                                        I like to roll my own too - if you know what you are doing then it works well.

                                        “That which can be asserted without evidence, can be dismissed without evidence.”

                                        ― Christopher Hitchens

                                        P 1 Reply Last reply
                                        0
                                        • S Slacker007

                                          We are thinking about moving from database first, to code first, with our new projects.

                                          D Offline
                                          D Offline
                                          Duncan Edwards Jones
                                          wrote on last edited by
                                          #29

                                          How about being really brave and discarding the relational model altogether[^]? (OK - possibly quite a big leap into the unknown...)

                                          S 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