[WARNING! This is an archived post and as such there may be things broken/missing here.. you have been warned.]
[I know I have your attention. So before you start reading this thinking it's an anti-ORM post or something of that nature. It's not. It's about something entirely different (look at the tags). I am actually attacking a fairly popular notion that I have run into a bit recently and while I may see the point I think the argument misses some critical things... that said... on with the post...]
I have been in Java hell over the last several days. To be specific I have been in Apache Cayenne ORM caching hell. I have been dealing with an update issue with my Mac project. Everything worked great on my windows machine (but not on the Mac).
This project is one that I removed some really bad data access code (my earliest code on this project didn's have Connection Pooling... Java doesn't have that by default), and replaced it with the Cayenne ORM. I started by converting only portions of the code that needed a better model (don't fault me it's really OLD code... I didn't know any better at the time). Anyway, as time went on I have moved more and more code to the Cayenne model because of model inconsistencies that have created bugs. The solution to my problem was to eject the Cayenne update and replace it with a stored proc call.
As I was doing this I began to re-think my ORM choice. I thought about how maybe this was a bad idea. In fact the whole idea of layering a relational database into a set of Objects seems like an abstraction... and as I have read, all abstractions are leaky to some extent, maybe we should be doing this.
Maybe we should go back to raw data calls. I mean if everything was in straight SQL calls without any object there would be less code to test and therefore easier to test as well as less buggy. I mean we wouldn't be abstracting the database. New programmers would not be uneducated in how the database works. They would quickly become experienced with the actual protocols.
In fact I think we should all open up TCP sockets to the DB. It should be faster and that way we are not abstracting anything.
So what am I talking about? Well, I read an article on our sister site (Devlicious) that was trying to explain Ayende's complaints about ASP.NET the leaky abstraction. This post troubled me (BTW, Sorry to do to you, Jeff what always gets done to me... if we ever meet I'll buy you a drink?); BTW, Jeff is not the only place I've read an article like this. I went back and searched Ayende's posts (I like this one), because Jeff's seems to imply that Ayende wasn't clear and that no one got it.
After reading Ayende's post I totally understood (and while I am not at the place to reject ASP.NET... I totally agree with his complaints... I know that's a shocker. To be honest I avoid any kind of dynamic form in my ASP.NET code for the reasons Ayende lists).
What troubled me was that Jeff complains that ASP.NET was made to look like Desktop programming. Someone in the comments says that it was meant to draw in the VB coder.
Back in the day when I was an ASP developer and I saw the ASP.NET beta, I quickly realized that it was going to make my life a little easier, but that it was totally different then anything I had ever done. Why? Because of the statelessness of the web, and how ASP.NET was an attempt to relieve us from these difficulties.
I think the reason that it seems like Desktop development is that MS was trying to create a model that looked similar between the 2 environments. If we could ask ScottGu I'd bet we would find that they were trying mitigate the number of things the developer had to know (because they were unleashing this massive framework on us all).
I could be wrong. But the big deal with ASP.NET is that it hides the stateless nature of the web.
This actually draws me onto a different thought. Before I say it I need to lay out a few of my own credentials.
I have been a professional developer for 14 years now (coming up on my 15th year early next year). Of those 14 years all but 3 have been in a web arena, so I'm an 11 year web veteran. I predominantly feed my family writing Intranet apps. I generally don't write shopping carts. I write reporting apps, I write data collection apps... I have written a number of very cool web apps (that in my opinion were not really worth the effort or money poured into them... I certain app I did back in 2001 that made live calls to TransUnion's credit services comes to mind; this same app also made calls to a phone company; the app never made it into production as far as I know -- thank God!)
That said, I think that HTML over HTTP is a lousy platform. Statelessness sucks! It's the one thing I would change about the web environment. If you don't know the history about HTML/HTTP you would do well to go back and read some on it. You'll find that originally all this was a Document library (not a platform for programming). The web server handed documents out (and at the heart of things, that's what it still is). [BTW, I finally get why so many want to use MVC or MVP... it definitely better mimics what is REALLY going on].
This is what something like SilverLight (or any of the competitors : Flash, Adobe Air, Java FX, etc.). I now have a plugin that I can write Rich Internet Apps and avoid some of the stateless mess... Before someone points this out... yes, this isn't new either. We have had this stuff for awhile, but these frameworks are starting to mature (Ok, you could also say that since MS created one we are all looking at them now).