DEV Community

Discussion on: ORM vs Pure SQL: Which to Choose?

Collapse
 
maorbril profile image
MaorBril

In my experience, ORMs are great until they're not, and then you're usually stuck with a very painful migration.

For example, at some point in my career I joined a team that modeled their data (highly normalizable, low cardinality) using an ORM.
That was pretty awesome, as we defined the model, added annotations and let the magic happen.
At some point we needed to introduce a fundamental requirement, we needed the database to be a time machine, meaning, You should be able to go to any point in time and get the system model at that point in time.

That simple requirement, threw ORM out the window, it actually threw referential integrity on the DB out the window.

Point of the story,
If you're using a well defined schema (and you always should) and a highly structured architecture,
Don't use an ORM.

Collapse
 
marmariadev profile image
Maria M.

Your anecdote emphasizes the importance of considering future requirements when choosing technology tools. While ORMs simplify the start, they may limit in complex scenarios. Keeping system design flexible to integrate different approaches as needed is important.