Pros and Cons of an ORM
I just came across this blog thanks to a post on Hal Helms Facebook page. Every design pattern we use has some advantages and then some drawbacks, it's just the nature of the beast. We're essentially purchasing the advantages we want by paying with the drawbacks, so the question becomes what is the advantage worth? In the case of a traditional ORM for example, is it worth a certain loss of direct control over our persistence layer (database) in order to theoretically simplify our day-to-day coding tasks.
I think Bill Karwin made some good points in his blog and it's interesting because we tend not to talk about or hear much about the drawbacks of the design patterns we like to use. This is actually just a basic fact of human nature. For example, if you happen to be a big fan of Linux, you're liable to conveniently forget anything about Linux that's challenging or frustrating. And of course the same thing happens with people who are fans of Microsoft. But it's good to remind ourselves from time to time that you can only see polarization from the outside. By this I mean, a fan boy usually doesn't think he's a fan boy. ;)
This blog entry points out the effect of polarization so that you can see the obvious biases between Glenn Block who is an ORM enthusiast and Karwin who is obviously not. In many cases they even disagree about whether something belongs in the pro column or the con column. So looking at the same feature, they have exactly opposite reactions to it. It doesn't get much simpler than this example from Karwin's blog where he gives his opinion of something Block describes as an advantage of ORM systems:
Block: 4. Rich query capability.Karwin: Absolutely wrong.
I'm always curious to know what other people really think about my software. DataFaucet seems to have been rather well received. But DataFaucet may also be difficult to categorize in particular as an ORM or simply as a Data Access Layer (DAL). Steve Bryant describes his DataMgr tool as a DAL - it's much smaller and much simpler than Reactor, Transfer or DataFaucet. But this sort of thing really depends who you ask, because according to Joe Rinehart, none of the tools billed as ORM for ColdFusion actually fit the definition of ORM. Joe's blog encouraged some additions to DataFaucet that are in source control, but not yet officially released, but, even with added features that make DataFaucet more like traditional ORM tools, does that make it an ORM? Well if you asked Bill Karwin again, who inspired this article, I think he would say no. And here's why I think Karwin would say that DataFaucet is not an ORM:
Block: 2. Huge reduction in code.Karwin: Depends. When executing simple CRUD operations against a single table, yes. When executing complex queries, most ORM implementations fail spectacularly compared to the simplicity of using SQL queries.
... Block: 4. Rich query capability.
Karwin: Absolutely wrong.
Block: 5. You can navigate object relationships transparently.
Karwin: This is definitely a negative rather than a positive. When you want a result set to include rows from dependent tables, do a JOIN. Doing the "lazy-load" approach, executing additional SQL queries internally when you reference columns of related tables, is usually less efficient. Leaving it up to the ORM internals deprives you of the opportunity to decide which solution is better.
Block: 6. Data loads are completely configurable ...
Karwin: This is not a benefit of an ORM. It is actually easier to achieve this using plain SQL.
My impression is that, although it might be a little slower, Karwin would not have these same objections to DataFaucet, which started it's life as an attempt to abstract the SQL language in a way that Ben Forta declared impossible. The key word was "portability" at the time, but in the process I managed to find ways to not only make querying the database portable, but easier as well. The ability to specify and/or keywords in search queries (think Google) is a prime example of a use case in which standard SQL is a big challenge, but DataFaucet is dead easy. The reason is because for all the ORM features in DataFaucet, it started as a "language". As far as I know, none of the other ORM systems for ColdFusion have approached this particular task.
Although I think Joe Rinehart might have been wrong when he said ColdFusion doesn't have any real ORM systems. If what you want really is a traditional ORM system, I believe there actually is one for ColdFusion. It's a built-in part of the FarCry framework called FourQ. It wasn't included in Steve Bryant's comparison of DAL tools, I think primarily because it's inseparable from FarCry, which if memory serves is an 8MB download (that's compressed). According to their own documentation, the objective of FourQ is to ensure that as a programmer, the word "database" never enters your mind. I'm not sure how effective they've been at achieving that goal, since I don't use it with any regularity. It may work beautifully if that's what you're after. But it does mean that you won't get the kind of querying flexibility that a system designed as a querying language like DataFaucet will give you.
It's not my intention to promote or to bash anyone here (except of course obviously to promote DataFaucet). But I think Karwin made some good points and these are worth considering when choosing between DAL or ORM frameworks.

I am very glad you posted this, and I totally agree with your sentiments about fanboyism. I have seen exactly what you've seen many, many times over the years. One good example is beta version of Windows. The beta testers are generally fanboys, who are not critical enough to report bugs they find. The result is that the final product is often torn apart by the "real" testers, who are not fanboys, and do not ignore the bugs. But that's another subject.
I have yet to try an Orm. And listening to people like Hal Helms that have valid reasons why they are a bad idea (in their opinion), I have had even less desire to use one. The problem is that I suspect that people like Hal and Karwin have probably tried an ORM before, and they have experience in both worlds. I have not tried one, so I can only lamely say that I like SQL better. :\
In contrast, your new caching framework doesn't really replace anything (if I'm not mistaken). Well, I realize that CF has some built-in caching capabilities, but they don't cover everything. So I'd be much more inclined to use CachBox because it fills a hole.
I still want to try DF some day, as I think you've made a compelling tool. From our past conversations, it seems that you have paid more attention to complex DB operations than I've seen with other ORM tools. But the trouble is, I don't really have a need for it at the moment. At work, my teammates would be very much opposed to using an ORM, and I am not working on any hobby projects at home (too much other stuff going on). But I do hope to use it some day. :)
Its one of those depends. Do you have a huge object graph? Are you using small hardware, or can your server hold the object graph that the ORM will load?
(Do you want to cache under your control or the ORM?)
How closely do you OBJECTS match to your TABLE. This may be a preverse statement but I believe the value of the ORM goes up when the need for the MAPPING goes down ...
just my opinion...
although you do have to be a bit careful that you don't over-rely on a particular tool or a particular technique (what they call the "golden hammer"). Anything can become a golden hammer I think if you let it... I think when you've got a list page/view a query (or a single object wrapped around one) makes a heck of a lot more sense than trying to get an array of objects. And yet, some people still try to get that array of N objects even though at that point OO has become the golden hammer.
I was just reading Marc Funero's article on his blog the other day about how he drove himself nuts trying to shoehorn everything he did into an unachievable standard of OO purity. http://www.advantexllc.com/blog/post.cfm/how-oo-al... This is not to say that everyone's going to do this, but human nature being what it is, it's easy to get pulled down that kind of a path to one extent or another. I've done it a few times. I don't think I've ever done it to the extent Marc described, but I could relate to some of the things he mentioned.