|
|
|
|
|
by blagie
870 days ago
|
|
I kind of disagree. If you're using an ORM, the ORM is the abstraction layer which should be sprinkled throughout the code. You shouldn't wrap a layer in a layer. If that's the right abstraction, use an ORM. If it's not, don't. If all you have are lists of items (a todo list, a set of employee records, a set of products), an ORM is a fine abstraction. If you have or expect to do something more complex, it's probably a bad abstraction. |
|
preventing people with this belief from sprinkling ORM code all throughout the codebase is reason enough to ban the use of an ORM.
The specifics of how you retrieve data is an implementation detail. If someone wants to use an ORM have at it, but don't sprinkle it throughout the codebase, place it behind well defined functionality (behind a system dedicated to pulling data).
The fact that ORM's have their own query language should be all you need to know.
One could easily argue that you should be able to manually interact with db readers all throughout the codebase, after all, it's an abstraction.
But no one would ever actually argue that. Like such forward-only db readers, ORM's are a way to pull data, they are not the abstraction layer for pulling data for your application.