Active Record still sucks, but...
First published at Monday 3 September 2007
Warning: This blog post is more then 17 years old – read and use with care.
Active Record still sucks, but...
My blog post "Why active record sucks" resulted in a series of interesting answers I want to share.
I am not talking about Ruby on Rails
I found it quite funny, even I never mentioned RoR in the complete blog post, nor I mention ruby anywhere on my website, the first commenters thought I am talking about RoR - something related to the recent hype I think ;).
So here is the small disclaimer: I only had a very quick look at RoR and strongly disliked several things which prevented me from taking a deeper look. This is also the reason I won't ever critize RoR in public, because I simply do not know enough about it to prove my point.
But, trying to use Active Record (AR) as a base for your business object imho is broken by design, even some of my critized points may be solved somehow in the RoR implementation of AR, as some commenters mention.
Using Active Record as base for business objects
I did not really wrote about this, but I admit, this has been touched by my blog post and perhaps I should have clarified this a bit more. I was talking about ORM in general, and not about MVC implementations, even I used the term business object from time to time.
Mike Seth wrote a reply in his blog post "ActiveRecord sucks, but Kore Nordmann is wrong", where he focusses more on this topic - and I think he really has a point. You should definitely read his article.
From a pure MVC point of view there are some things which just do not belong in your model, like the database abstraction, which AR offers. I personally do not follow this point of view in every implementation, because it does not make sense in every application, but when you try to implement a general MVC, you should defenitely care about that. For more details, just read his blog post. ;)
Mike says that this midterm conclusion is wrong:
You either destroy your business objects or your DB model.
Which still is the case, if you try to use AR as a base for your business objects - which he also states as wrong. So I think, he did not really mean, that my conclusion is wrong, but that the implication of this conclusion is wrong, that you could even consider AR as business objects in some MVC.
Looking through his other blog post funnily he also has a small rant in his blog, that you should not parse using regular expressions, like I did some days ago, too. ;)
Subscribe to updates
There are multiple ways to stay updated with new posts on my blog: