News for hackers. Stuff that matters.
Re:Whatever happened to programming? by wlievens on Thursday March 04, 2010 @03:30AM (#1166448)
I don't get why some people keep praising SQL like this. SQL is great for complex queries that contain valuable logic, but it's not expressive at all when you want to do something trivial. Getting all the attributes of user X is so much more work, and harder to maintain, in SQL than it is in any ORM.

"select name, pass, hash, email, realname from user where id = ?"

versus

session.get("User", x)

Re:Whatever happened to programming? by jrockway on Thursday March 04, 2010 @04:01AM (#1166486)
SQL is not particularly nice for complex queries, either. The underlying model is good, but the particular syntax they chose is verbose, confusing, and non-portable.
Re:Whatever happened to programming? by wlievens on Thursday March 04, 2010 @09:36AM (#1166996)
I kind of agree, but I was conceding the most reasonable argument to the parent.
Re:Whatever happened to programming? by james2vegas on Thursday March 04, 2010 @06:42AM (#1166658)
'SELECT * FROM user WHERE id = ?' OR 'SELECT getUser(?)' presuming you have a stored procedure/function getUser that returns the data you need, and you should (or a view, at least)
Re:Whatever happened to programming? by mattmanser on Thursday March 04, 2010 @07:43AM (#1166751)
SELECT *? A function in the SELECT statment?

Oh dear god, a blasphemer!

The former can cause performance problems if you have blobs as well as being an unnecessary security hole, the latter can cause performance problems over large datasets as it often forces the execution plan away from a set based solution.

Re:Whatever happened to programming? by wlievens on Thursday March 04, 2010 @09:37AM (#1167000)
The fact that using the most trivial of examples triggers a discussion in on itself helps to prove my point.

Nobody debates session.getUser(id)