You’ll have my SQL when you pry my keyboard from my cold dead hands

27 Jun

image Background – Some people don’t like the Entity Framework, some do.  Many see the need to blog about it.  You can guess the rest, or JFGI if your need more info.

The debate is nothing new; we have databases that are really good at storing data, searching that data, and spitting it back up.  Problem is the format spit up doesn’t play well with how we use the data in code.  So we write some code to translate from one system to another.  If you want to be fancy, call it Object Relational Mapping.  JFGI as ORM if you want.

Any skinned cat will tell you, there is more than one solution to a problem.  That’s not a problem, that’s called choice.  A problem is when one two sides argue over different solutions so loudly you cannot hear what they are saying.  It’s often overlooked that there are more than the two options present.

I write all my SQL.  I use a good deal of strongly typed DataSets.  I write my ORM code.  I have no problem with this, and have good reasons for doing such.

First, I know SQL really well, and more importantly I understand how to manage a database.  I’m not a DBA – I’ve never setup a quad-node cluster with latency-free fail over across multiple data centers – but I know how to read a query plan and setup an index.  I have over a decade of experience with setting up a database behind and optimizing the system – I see no point in tossing that hard earned experience away.

Second, and this is probably the most important factor, your ORM doesn’t matter.  Your framework doesn’t matter.  Your language, IDE, and ergonomic mouse you paid way too much for, don’t matter.  When the servers start coming down, it’s IO.  Disk or network bottlenecks are killing you.  We have the RAM folks, and the clock cycles are so plentiful we have to invent new ways of writing code just to use them all.  When all hell has broken loose, you need to know how your code works with the underlying IO; the fact you concatenated a few strings inline instead of using StringBuilder doesn’t amount to a hill of beans.

So what do you take from this?  ORMs are evil and true ninjas master SQL?  No.  You take from this that no matter what you use, it is 100% your responsibility to understand how your platform works at the IO level and how to adjust it when needed.  You take from this that you pick a tool based on you and your teams comfort level with that tool, and you don’t bother to get caught up in pointless saber rattling posts like this one.

If this has you all worked up, well… you can STFW for "kittens" or something.