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.
  • 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
            • S Slacker007

              Avijnata wrote:

              Spec First

              That goes without saying.

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

              Slacker007 wrote:

              That goes without saying.

              Not sure whether this is true. In more than 50 percent of the cases.

              S 1 Reply Last reply
              0
              • A Amarnath S

                Slacker007 wrote:

                That goes without saying.

                Not sure whether this is true. In more than 50 percent of the cases.

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

                Avijnata wrote:

                In more than 50 percent of the cases.

                You have done statistical analysis on this? :laugh: I have never worked for a software shop that did not require specs. I'm sure they are out there...50% of the time, at least. :) -- just teasing you.

                A 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
                  Dave Kreskowiak
                  wrote on last edited by
                  #32

                  I'm working on a project right now and we used Code First. There's some nice stuff about it if you keep your database simple, but what database ever ends up being simple, right? Stuff like Migrations can make changes very easy to implement but others a real pain in the ass. If you've got a very small team, like under 5 people, Migrations can be easy to manage. If not, it can be a huge pain. It's probably best to keep the Migrations limited to just a few people on the team until the database is fleshed out. Multiple people putting in migrations on the same table at the same time can make your life miserable. We ran into a couple of problems like this and I'm one of two people working on this project. If you're going to have multiple people doing Migrations coordination of those changes is paramount. I can't stress that enough. If you want to avoid problems, you have to make sure no two people are making changes to the same table at the same time. You REALLY have to understand your data and how relationships work before you even think of starting with Code First. Code First isn't the best when determining how it's going to setup a relationship and you really have to know your DB stuff to make sure it's getting it correct. When Code First doesn't get a relationship correct or exactly the way you want it there is a rather steep learning curve to the syntax to configure it correctly and it only gets steeper if you don't know enough of the detail of how the database side works and the terminology involved. Would I use Code First again? Sure, but not for large projects. I'd keep it to smaller ones only.

                  A guide to posting questions on CodeProject

                  Click this: Asking questions is a skill. Seriously, do it.
                  Dave Kreskowiak

                  S 1 Reply Last reply
                  0
                  • D Duncan Edwards Jones

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

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

                    Interesting. Unfortunately, the world I live in revolves around "what can you give me in a certain time frame?". This does not lend itself well to theoretical software development, or hobby craft, where it may or may not work. Now, after a few years, and it has moved from philosophy into mainstream practice, then I would consider adopting. --> You used the phrase "may free us", in your linked page article, which has a certain level of uncertainty to me, hence the tone of my reply. :)

                    D 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      I'm working on a project right now and we used Code First. There's some nice stuff about it if you keep your database simple, but what database ever ends up being simple, right? Stuff like Migrations can make changes very easy to implement but others a real pain in the ass. If you've got a very small team, like under 5 people, Migrations can be easy to manage. If not, it can be a huge pain. It's probably best to keep the Migrations limited to just a few people on the team until the database is fleshed out. Multiple people putting in migrations on the same table at the same time can make your life miserable. We ran into a couple of problems like this and I'm one of two people working on this project. If you're going to have multiple people doing Migrations coordination of those changes is paramount. I can't stress that enough. If you want to avoid problems, you have to make sure no two people are making changes to the same table at the same time. You REALLY have to understand your data and how relationships work before you even think of starting with Code First. Code First isn't the best when determining how it's going to setup a relationship and you really have to know your DB stuff to make sure it's getting it correct. When Code First doesn't get a relationship correct or exactly the way you want it there is a rather steep learning curve to the syntax to configure it correctly and it only gets steeper if you don't know enough of the detail of how the database side works and the terminology involved. Would I use Code First again? Sure, but not for large projects. I'd keep it to smaller ones only.

                      A guide to posting questions on CodeProject

                      Click this: Asking questions is a skill. Seriously, do it.
                      Dave Kreskowiak

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

                      :thumbsup:

                      1 Reply Last reply
                      0
                      • S Slacker007

                        Interesting. Unfortunately, the world I live in revolves around "what can you give me in a certain time frame?". This does not lend itself well to theoretical software development, or hobby craft, where it may or may not work. Now, after a few years, and it has moved from philosophy into mainstream practice, then I would consider adopting. --> You used the phrase "may free us", in your linked page article, which has a certain level of uncertainty to me, hence the tone of my reply. :)

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

                        Some industries (financial services, mobile phone billing etc.) are already using this model. Unfortunately the code we/they use is very proprietary and this kind of thing is not used in college courses (yet). Commercial offerings do exist - in particular Event Store[^]

                        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.

                          S Offline
                          S Offline
                          Sascha Lefevre
                          wrote on last edited by
                          #36

                          Slacker007 wrote:

                          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".

                          Can you share the link?

                          If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                          S 1 Reply Last reply
                          0
                          • S Slacker007

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

                            M Offline
                            M Offline
                            Marco Bertschi
                            wrote on last edited by
                            #37

                            I like it. Different from DB first, but the automatic db intialization is neat.

                            "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                            1 Reply Last reply
                            0
                            • S Sascha Lefevre

                              Slacker007 wrote:

                              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".

                              Can you share the link?

                              If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

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

                              My buddy has it. Will post back with it when I get it. I watched part of the vid clip on his machine, not mine.

                              S 1 Reply Last reply
                              0
                              • S Slacker007

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

                                pkfoxP Offline
                                pkfoxP Offline
                                pkfox
                                wrote on last edited by
                                #39

                                Get the database right first, the rest is easy

                                We can’t stop here, this is bat country - Hunter S Thompson RIP

                                1 Reply Last reply
                                0
                                • S Slacker007

                                  My buddy has it. Will post back with it when I get it. I watched part of the vid clip on his machine, not mine.

                                  S Offline
                                  S Offline
                                  Sascha Lefevre
                                  wrote on last edited by
                                  #40

                                  :thumbsup:

                                  If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                                  S 1 Reply Last reply
                                  0
                                  • S Slacker007

                                    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 Offline
                                    G Offline
                                    Gavin Coates
                                    wrote on last edited by
                                    #41

                                    But how many times has someone updated one, and forgot to update the other? At least with auto-generation, you're one click away from regenerating. With code first, you need to sit down and verify every recent change to ensure it has been incorporated.

                                    1 Reply Last reply
                                    0
                                    • S Sascha Lefevre

                                      :thumbsup:

                                      If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

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

                                      Learn ASP.NET Online – Microsoft Virtual Academy[^] Under "Creating and configuring models" --> Creating models --> around 23:40 but start at around 22:00 to get some intro context. I heard that the SNAFU they had during the demo happens a lot to people, especially those who are trying to get up to speed with "code first".

                                      S 1 Reply Last reply
                                      0
                                      • L Lost User

                                        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 Offline
                                        S Offline
                                        Slacker007
                                        wrote on last edited by
                                        #43

                                        Link to comment with link to video [^]

                                        L 1 Reply Last reply
                                        0
                                        • S Slacker007

                                          Learn ASP.NET Online – Microsoft Virtual Academy[^] Under "Creating and configuring models" --> Creating models --> around 23:40 but start at around 22:00 to get some intro context. I heard that the SNAFU they had during the demo happens a lot to people, especially those who are trying to get up to speed with "code first".

                                          S Offline
                                          S Offline
                                          Sascha Lefevre
                                          wrote on last edited by
                                          #44

                                          Thank you! Will take a look..

                                          If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                                          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