The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
There's a lot of waffle in the responses but the truth is as it is for most things... It depends on what you're developing. Some people have alluded to this.
I have worked on projects that have used code first effectively. No performance bottlenecks, easy deployments, very neat code. Easy to follow and all in one place. If you have a fairly simple schema to create, code first is not going to be a problem. If you have a more complex schema, then you may have to evaluate it a bit more.
I have worked on projects that code the DB first. This gives you the most control and is the more consisitent approach when writing stored procedures, triggers and other object types. If using Visual Studio (assuming as you're using EF) and if you're also using SQL Server then Visual Studio DB projects are great for modelling databases and doing quick and easy deployments.
ORMs are great but use with a little caution as you may introduce unnecessary overheads.
In summary, to answer your question more directly, yes code first is used for real applicstions/projects. On the question of whether to aspire to it, I do not believe it should be considered a standard or any sort of evolution of development - you would use it based on the merits for your application.
We always do code first, but we also follow a very strict and sane DB design principle. "Everything is flat by design and we optimize for lowest complexity."
Juniors that optimize for "This is going to be faster and/or more efficient" are getting stabbed with a knife by me personally.
People prefer DB first, because they like to decide what the data should look like.. which is also fundamentally wrong.
Data already has a defined structure when it gets into your system, and has a defined structure when it comes out.
All you need to do is flatten it in a safe way, so you can persistently store it, when it's in between those 2 states.
The worst of the bunch are Enterprise folks that go on and on about Business Objects or Domain Objects.
They're willfully ignoring their core business (= selling a product or service) in favor of making arbitrary decisions about things they've invented themselves.
We call that "having a god complex", because it's fun playing god and creating stuff that people will build for you.
I totally get that. But they should do that in Civ5 or something, not at work.
Because I haven't spent the time to figure out how to code first write Clustered-Primary Key constraint, foreign key cascading rules, some foreign keys without requirement constraint, additional indexes that I can see a mile away.
And that one bad time when I first started a code first project, then looked at the database and cried for all the 20+ character long guid names it attached to everything.
In response to my company getting all worked up over security, I took the plunge and ordered comedy ID Lanyards (I was drunk when I pushed the button). Now I have a pile of funny lanyards, which at least one CP member has contacted me about so being a private member, not running a business can I post details of how to get these things from me via eBay with enraging one the Hamsters .
Did your company pay for these lanyards or did you pay for these with your own money? If the company paid for them, then you can't sell them without the company's consent; seen a few get fired for this over the years (old printers, toner cartridges, etc.)
That's the natural order of things in most cases. Wimminz 'decorate' everything with garish pots and vases and the cat is the only one who has the balls to systematically take care of all that useless stuff. What follows is another catfight with both sides behaving remarkably similar: Hissing and shrieking, puffing up the hair, scatching and biting...
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
You just need the correct strategy to make this work. Mrs. Wife has her houseplants on our screened-in porch during the summer on a large table. She deliberately leaves a bare patch on the table for the cat and her water bowl. This is a good spot for her, as she can keep a wary eye out for our two greyhounds, who think she (the cat) looks just like a track lure. The wife's plants get plenty of sun, the plants shelter the cat's hiding place, and the greyhounds don't chase the cat too much.
Of course fall is now coming on and the plants are coming back inside...
I've decided to get a couple of their EGG loudspeakers.
Wonderful things, they sound super nice.
The Cambridge YOYO M were a set of stereo bluetooth portable loudspeakers that sound good, not that good, but they add some delay to the sound and this makes it impossible to see films using them... nothing that I do often, but with the EGG ones that doesn't happen and they sound way better (given my inexpert ears).
Thank you for all your comments in the previous post.
Last Visit: 1-Apr-20 16:44 Last Update: 1-Apr-20 16:44