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.
  • F Frank Alviani

    Definitely prefer a Sumatra or French Roast.:suss:

    My long term goal is to live forever. So far, so good...

    J Offline
    J Offline
    jeron1
    wrote on last edited by
    #46

    Whilst I prefer the one's that on sale. :)

    "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

    S 1 Reply Last reply
    0
    • S Slacker007

      Link to comment with link to video [^]

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

      Tx :)

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

      1 Reply Last reply
      0
      • S Slacker007

        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 Offline
        A Offline
        Amarnath S
        wrote on last edited by
        #48

        :thumbsup:

        1 Reply Last reply
        0
        • J Jacquers

          I still prefer to design the database the traditional way, but the migrations that code first uses are pretty cool.

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #49

          Can you elaborate on that please?

          Regards, Nish


          Website: www.voidnish.com Blog: voidnish.wordpress.com

          J 1 Reply Last reply
          0
          • S Slacker007

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

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

            Frack no. It's the epitome of taking a very bad idea and following it ad absurdum.

            1 Reply Last reply
            0
            • G GuyThiebaut

              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 Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #51

              GuyThiebaut wrote:

              if you know what you are doing

              Exactly; from what I see, the "latest and greatest shiniest new" tools are designed for a different demographic. :suss: If you don't know what you're doing, better have someone else do it for you.

              1 Reply Last reply
              0
              • N Nish Nishant

                Can you elaborate on that please?

                Regards, Nish


                Website: www.voidnish.com Blog: voidnish.wordpress.com

                J Offline
                J Offline
                Jacquers
                wrote on last edited by
                #52

                Here is an example click[^] It can generate scripts and apply them to the database based on changes made to the POCO classes used.

                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
                  dazfuller
                  wrote on last edited by
                  #53

                  I do indeed. You need to spend some time ensuring that your entity changes will produce the database design you're expecting (e.g. table-per-class, table-per-hierarchy etc...) and you may want to write some helpers to make adding things like indexes a bit easier but otherwise I've found it to be a very neat way of doing things. One thing to consider though is your initial database creation, for this I'd suggest either having a script to create the database and manage the configuration of it (not my preferred) or create a Database Project and output a DACPAC (much better and has better deployment options if you're using MS SQL Server). The reason for this is that if you use something like EF migrations then you'll get default database settings and sizings when it's created which you may not want, using a DACPAC means you get control over things like collation and recovery modes.

                  Eagles may soar, but weasels don't get sucked into jet engines

                  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!

                    R Offline
                    R Offline
                    RUs123
                    wrote on last edited by
                    #54

                    Hm, how does your heart manage with all that caffeine? I'm genuinely curious as I've tried drinking more coffee but it only made my heart beat faster, my mind was still very interested in sleeping. :) Or maybe I haven't developed a tolerance yet - haven't been drinking coffee regularly for too long.

                    1 Reply Last reply
                    0
                    • S Slacker007

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

                      F Offline
                      F Offline
                      Flo Lee
                      wrote on last edited by
                      #55

                      I was raised with manual DB creation and then creating code that accesses the DB. This worked well with the waterfall model, where (theoretically) no changes would appear after planning and design (on paper) were over. But in recent years, as things became more "agile" (read: people do not want to make decisions, people want to change their mind very often, people just lack knowing the full story) I started to change my mind. We had lots of problems in our application when we were adding fields to an already existing complex DB and then implementing the handling code. Sometimes datatypes were wrong. Sometimes fieldnames were misspelled etc especially when the change was not implemented by just only one person. Another strong point for code-first entities design was the thing with SVN: While we had good practice already with versioning our code, the DB was hard to track in SVN. Ultimately people started to checkin binary backups from SQL Server, but you could not diff them etc. With code-first we now have a singular, unique description of the Db in Plaintext, with matching datatypes and compile-time error checks. Our test cycles are much easier now. BR Florian

                      1 Reply Last reply
                      0
                      • J jeron1

                        Whilst I prefer the one's that on sale. :)

                        "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

                        S Offline
                        S Offline
                        SPoss
                        wrote on last edited by
                        #56

                        what about different flavours of coffee? does it help? Its normal coffee first (medium don't want to shock the heart to early, got work to do), then mid-morning, may be a orange flavoured coffee or cameral. Just received some Chocolate Mint, but not sure I like this one.

                        X 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
                          dietmar paul schoder
                          wrote on last edited by
                          #57

                          I would not think about it. I would do it. We did it, it is a paradise.

                          1 Reply Last reply
                          0
                          • S Slacker007

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

                            Q Offline
                            Q Offline
                            Quirkafleeg
                            wrote on last edited by
                            #58

                            You mean diving into the code isn't a good idea? Youtube analogy[^]

                            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.

                              L Offline
                              L Offline
                              Layinka
                              wrote on last edited by
                              #59

                              I am not sure how this can happen. If you were using Entity framework, i know this can't happen. EF will inform you that the database and the POCO are out of sync. Also, EF7 is strictly going to be Code first, though you have the option of generating the classes form an already existing db, but after that code first. I think i prefer code first a lot, its very RAD, and migrations allow me to tweak almost anything nowadays.

                              S 1 Reply Last reply
                              0
                              • S SPoss

                                what about different flavours of coffee? does it help? Its normal coffee first (medium don't want to shock the heart to early, got work to do), then mid-morning, may be a orange flavoured coffee or cameral. Just received some Chocolate Mint, but not sure I like this one.

                                X Offline
                                X Offline
                                xiecsuk
                                wrote on last edited by
                                #60

                                SPoss wrote: Just received some Chocolate Mint Ooooh, I just love After Eight Chocolate Mints. That thin layer of dark chocolate hiding the peppermint cream filling. Gorgeous!!!

                                1 Reply Last reply
                                0
                                • W WiganLatics

                                  BaconSandwichFirst

                                  X Offline
                                  X Offline
                                  xiecsuk
                                  wrote on last edited by
                                  #61

                                  But then you would being from the right side of the Pennines!! That's if I read your signature right. And like me, I suppose it's tea during the day with a single cup of coffee after one's evening meal.

                                  1 Reply Last reply
                                  0
                                  • R RUs123

                                    I'm more of a coffee first developer.

                                    A Offline
                                    A Offline
                                    Anna Jayne Metcalfe
                                    wrote on last edited by
                                    #62

                                    Think of it as #caffeinedrivendevelopment in action.

                                    Anna (@annajayne) Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                                    1 Reply Last reply
                                    0
                                    • L Layinka

                                      I am not sure how this can happen. If you were using Entity framework, i know this can't happen. EF will inform you that the database and the POCO are out of sync. Also, EF7 is strictly going to be Code first, though you have the option of generating the classes form an already existing db, but after that code first. I think i prefer code first a lot, its very RAD, and migrations allow me to tweak almost anything nowadays.

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

                                      Layinka wrote:

                                      EF7 is strictly going to be Code first

                                      Good to know.

                                      1 Reply Last reply
                                      0
                                      • S Slacker007

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

                                        B Offline
                                        B Offline
                                        boarderstu
                                        wrote on last edited by
                                        #64

                                        My initial question is why? What are you going to gain? Etc..

                                        1 Reply Last reply
                                        0
                                        • S Slacker007

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

                                          U Offline
                                          U Offline
                                          User 12206071
                                          wrote on last edited by
                                          #65

                                          I like Break Before and After Code

                                          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