loading...

re: How difficult do you find SQL? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: "more effective than an ORM"? I find that a bit ridiculous, to be honest. I checked out the article. His points are basically: configuration, debug...

Ryan,

You make a lot of really good points there. I’m just speaking to my experience. I’ve been working with SQL since I was in high school and I’m more comfortable with it than any other language, so I tend to prefer to have direct control over database interactions. I should say SQL is more effective than ORMs for me.

You’re absolutely right about being database agnostic. ORMs are great for future proofing your application to remain datastore agnostic, and that’s a good thing. The separation of storage and business logic is an important model to follow and ORMs certainly make that easier.

Much of my team’s experience comes in high scale applications, where server-side performance is critical. In a standard web application, developers may not mind the added latency of an ORM, but we’ve found that as applications scale the ORM becomes a chokepoint that can’t simply be optimized away. Proper architecture can help with this, but my personal preference is to avoid them. There are plenty of valid arguments to include ORMs, many of which you made here.

In my experience maintaining ORM code sucks and sending raw SQL through an ORM sort of defeats the purpose. In my head, ORMs complicate the process by adding an abstraction layer. I think developers tend to choose ORMs because it abstracts them from SQL and they return data back as objects, which is far easier to code around than an RDMBS table, which effectively sends back an array of arrays. Going back to the initial discussion point, is SQL hard? I think if your answer is yes, then an ORM is a great choice because you can just focus on your app. If your answer is no, and you like the control SQL provides, then an ORM can be avoided.

Overall, it’s important to use the right tool for the job, understand the performance implications, and ensure the project can be delivered on time. The answer is pretty much always “it depends.”

As for HarperDB, we are structured object store with SQL capabilities, which means we natively return objects in our responses. This helps eliminate the need for an ORM in many use cases.

I’m new to dev.to, but I love these kinds of discussions! Thanks for starting a great thread!

Code of Conduct Report abuse