|
The only time I've have to deal with "Code First" was with a lead developer who was scared of SQL due to tooo many run-ins with Little Bobby.
Took me almost a year to clean up an database created by LINQtoSQL (pre EF)
Director of Transmogrification Services
Shinobi of Query Language
Master of Yoda Conditional
|
|
|
|
|
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.
|
|
|
|
|
If starting from scratch, the advantage of "code first" is that the database that is generated "works" with EF.
On the other hand, database first assumes you have the smarts to now "confgure" EF to "consume" whatever convoluted schema someone managed to create using "SQL".
Now try and keep the 2 in sync.
The skill is in knowing when to use which; or both; and transitioning from one to the other.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
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.
|
|
|
|
|
Them hamsters eat your cable? I saw you!
"If we don't change direction, we'll end up where we're going"
modified 11-Oct-18 5:45am.
|
|
|
|
|
For some reason - probably a CTKI error - the Lounge wasn't showing me updates, so I missed your CCC by over an hour!
As soon as I posted, however ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi All,
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.)
|
|
|
|
|
I paid (drunkenly) for them, I have given up trying to claim expenses over the year's.
|
|
|
|
|
What’s it going to be then, eh? A sundial job colour? (1, 9, 6)
"If we don't change direction, we'll end up where we're going"
modified 11-Oct-18 6:24am.
|
|
|
|
|
Though I had it with a multiple choice - but not enough letters
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
I am stretching the CCC rules a little bit, but it accidentally works nicely with my signature, in a way.
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
A clockwork orange ?
A sundial = clock
work = job
orange = colour
and it's associated with clockwork orange ( didn't know that but looked it up when I got it )
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Bingo! You are up Friday!
The movie has been in my system for 30 years, but the book... I just finished it, and I could not resist the temptation, even if it was a stretch.
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
Nice little clue
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
Yes, a great book, but so are most of Burgess's other novels.
|
|
|
|
|
|
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...
Software Zen: delete this;
|
|
|
|
|
|
Works for me this week. Monday, Tuesday, and Wednesday have all escaped being "everything's broken and we're all gonna die" days by the slimmest of margins. The jury's still out on today .
Software Zen: delete this;
|
|
|
|
|
A brand I did not know it even existed: KEF.
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.
|
|
|
|
|
KEF - Wikipedia[^] A classic loudspeaker brand. Haven't kept up with their modern products, but the old Celestes were a marvel.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Never heard of them... which can give you an idea of my knowledge in hi-fi matters...
🤣🤣🤣
|
|
|
|