|
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
|
|
|
|
|
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.
If you don't know what you're doing, better have someone else do it for you.
|
|
|
|
|
Old school here too. I can't recall the last time I let either DB or code be auto-created for me.
|
|
|
|
|
Not really, no.
It feels better to start with but when you have a decent size model you basically have no way to visualise it except turning it into a database and then looking at that.
|
|
|
|
|
I have seen the many-tentacled monsters manifested from the murky depths of Code First. Epi's with their SAS armor fear to step within the shadow of these Lovecraftian beasts. The Oracles on high, throw ever more power against it, and the leviathan will not be sated. When it takes 109 left joins, 20 sub-selects and 17 decodes to pull a single death record, there is nothing but eye-clawing madness and sound of your own screaming.
So... no. I do not like Code First.
|
|
|
|
|
I wouldn't know how to normalize a code-first model
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
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.
|
|
|
|
|
Slacker007 wrote: Just saw a demo online a few days ago Still got the link?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Tx
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
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".
|
|
|
|
|
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
|
|
|
|
|
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");
}
|
|
|
|
|
Spec First, before any of these
|
|
|
|
|
Avijnata wrote:
That goes without saying.
|
|
|
|
|
Slacker007 wrote: That goes without saying.
Not sure whether this is true. In more than 50 percent of the cases.
|
|
|
|
|
Avijnata wrote: In more than 50 percent of the cases.
You have done statistical analysis on this?
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.
|
|
|
|
|
|
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
|
|
|
|
|
Thanks for your feedback. I appreciate it.
|
|
|
|
|
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(); }
|
|
|
|
|
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
|
|
|
|