Never use any language feature that describes itself as "Smart" or "Magic."
expatsoftware.com
expatsoftware.com
My reading of the article was "I didn't know how to use Hibernate or ActiveRecord, but I tried anyway, and they didn't work right." Yeah, that's the software's fault, not yours. Riiight.
As for magic_quotes, the problem was it was too general, not that it was too magical. Have you ever written this:
run_query("SELECT * FROM foo WHERE foo=?", "'bar'")
Congratulations, the "'bar'" is magically quoted! It works because you are specifying exactly what you want quoted and why.All in all, this has got to be one of the worst articles I've ever read in my life. And that is saying a lot.
The idea here is not that abstractions are bad, it's that those that are frequently described by the people who made them as "smart" or "magic" are often not very helpful, and tend to do more harm than good. There are some exceptions, but good abstractions, while they may be described as "smart", don't usually include that in their name, and are rarely if ever called "magic".
The problem is not with these two packages, but with the developers who use them without taking the time to figure out exactly what they do. Just because something makes a task convenient or easy, does not mean you aren't required to understand how they work.
It's copy/paste, cargo-cult programming, and you can't blame the tools.
Otherwise, show what you're doing, or don't do it at all.
http://www.joelonsoftware.com/articles/LeakyAbstractions.htm...
Rails pluralization rules are an interesting example, they leak--I have to know about exceptions, but they're consistent enough that they, in my opinion, just pass the threshold. Nearly-perfect magic is most tolerable when dealing with structure, not data and when the magic's imperfection is consistent, repeatable, and documented.
This article however, is extremely bad and its arguments simply don't make sense. Magic isn't bad, leaky abstractions + developers who don't understand it are bad. If he think ORM's don't solve a problem then he hasn't written enough SQL to tire of the insanity of doing it manually when CRUD should clearly be automated because it's so god damn repetitive. Repetition + boredom should always be a signal to automate.
I touch a bit on the framework we use at Expat here:
http://www.expatsoftware.com/articles/2007/03/examplecode-pr...
Basically, you can think of it as an early-bound Rails. We use CodeSmith to generate a bunch of classes, stored procedures and unit tests based on the existing database schema whenever we make a change to it. Those classes, along with generated wrappers for all our hand-built stored procedures get compiled into the project. This saves us from ever having to guess what SQL we'll get for a given operation, and allows us to pause at any point and be looking at readable code that does real, undestandable work and that can be debugged through.
That may seem like a minor distinction, but then I bet you've tried debugging thru ActiveRecord once or twice and I doubt it was any fun. This way, we keep the same fast development pace that a traditional ORM might give us, without sacrificing the debugability and maintainability side (or relying on Magic happening behind the scenes.)
Or, shorter: "Garbage in, garbage out."