3 ms·
There's more to database programming than just concocting queries. Once you've built a query you want, you have to run it and handle the results somehow. Most
by jrockway 15y ago
There's more to database programming than just concocting queries. Once you've built a query you want, you have to run it and handle the results somehow. Most object-oriented programs are going to use an object for this. So it makes sense to just write your whole program in terms of set operations on top of predefined objects which map pretty nicely to the database's idea of objects.
- fauigerzigerk 15y agoYou are confirming what I said originally. What you call "handle the result" is quite frequently something that can be done in a set oriented fashion using orders of magnitude less code. But what ORMs encourage you to do is to load a bunch of objects and then use procedural code to do the real thing. I fully understand that not all types of algorithms and datastructures lend themselves to set oriented thinking. I work mostly with those nowadays. But for those cases it makes no sense to use RDBMS at all.
- Confusion 15y agoBut what ORMs encourage you to do is to load a bunch of objects and then use procedural code to do the real thing. The exact same thing happens when you directly express the query in SQL. You load a bunch of objects and post-process them, to do what SQL can't do. Unless you count the various languages you can use in stored procedures in RDBMS's, but those aren't set-oriented SQL either.
- fauigerzigerk 15y agoIf I want to do something that SQL can't do I don't use SQL. Using SQL is not an end in itself. My rule of thumb is pretty simple. I use whatever takes fewer and/or simpler lines of code unless it's a lot slower. The raging scalability debate is a different matter. I'm sure if you're Google there are good reasons to write more lines of code in order to scale better. I'm not Google so I can prioritize productivity over scalability.