3 ms·
Interesting, it looks like you see it in different light. Really, my point was that, first, the problem of automatic mapping doesn't need to be solved - its ok
by shashurup 6y ago
Interesting, it looks like you see it in different light. Really, my point was that, first, the problem of automatic mapping doesn't need to be solved - its ok to do it manually IMO, second, I'm even unsure that OO is more efficient in data processing. This is definitely subjective, but in my experience in most cases OO didn't add up much to the clarity of my intentions.
To be honest the incentive for me to post this was mostly accumulated irritatation by the fact that a mere side effect of the mapping turned to countless attempts to model SQL in the host language. Really, IMO, all of them are worse than SQL, all of them waste your time spent learning them, with all of them sooner or later you find yourself in a position when you figure how to express the SQL you want with the DSL at hand (again, it is hard to qualify this other than wasting time).
- ivan_gammel 6y agoThe object-relational mapping happens everytime you fetch the data from a relational database in an object-oriented program. The moment when you try to generify your code to avoid repeating lists of columns in queries and parsing of similar result sets is the moment you create an ORM tool. All the efforts to create DSLs are coming from the idea that silver bullet exists and it’s possible to cover all use cases by a single solution. It doesn’t. Trivial ORM is enough to cover 80-90% of use cases, for the rest it doesn’t make sense to try — they are usually so unique that running plain SQL and parsing the result is the best. So I agree with you, it’s probably a waste of time to build all those DSLs when we could try to improve the simple ORM experience (Spring Data is moving in the Right direction here).
- shashurup 6y agoAha, I got it now. Technically you are absolutely correct. The mapping always happens. I was just aiming at cases where original ORM intent was to provide more "smooth" OO expirience, such as having object references instead of foreign keys, 1 to 1 class to entity mapping etc.