4 ms·
Everyone uses an ORM. You use a well known, documented, and supported ORM, or you're writing your own wether you realize it or not. Don't believe me? 1. Do yo
by nsxwolf 14y ago
Everyone uses an ORM. You use a well known, documented, and supported ORM, or you're writing your own wether you realize it or not.
Don't believe me?
1. Do you have objects?
2. Do you have relational data?
There's the O and the R. How do you get them together? That's where the M comes in. You use a library that knows how to do the M, or you do your own M with a bunch of getters and setters, for loops and case statements.
Eventually, any little change to the database becomes a regression nightmare.
Once you find yourself saying "I know, I'll build a code generator to create these DAOs", that's when you should finally realize you should have used a real ORM. Sadly, many people still won't get it at this point and will go ahead with the code generator.
- papsosouid 14y ago>Everyone uses an ORM Bullshit. You are making absurd generalizations based on your personal view of how the rest of the world operates. >1. Do you have objects? No, I do not. That makes it pretty obvious that I do not use an ORM doesn't it? "Everyone" includes more than just people using OO languages.
- nsxwolf 14y agoDo you use data structures? Do you use variables? Do you use anything that in any way stores the values from your database so your application can work with them? Then you are doing XRM, where X = Objects, structs, vars...
- papsosouid 14y agoMore wild assumptions. The M in ORM stands for mapping. I do not map anything, the data comes back in tuples, and is used exactly as-is. Just because it gets stored in a variable doesn't mean there is any form of mapping going on.
- nissimk 14y agoI don't know why you're being downvoted. Even when you're using an oo language, there's not always a reason to force your query results into an "Object." Frequently the only object you need is a 2 dimensional data structure which could be a list of dictionaries, or a DataTable or something like that. You don't always need a special named structure for the results of every query. ORM's always seem to be designed for people who have a one to one mapping between data structures in their program and tables in their DB. I find that this very rarely makes sense, particularly when you're talking about analytical applications.
- nsxwolf 14y agoGreat, you have a list of dictionaries of dictionaries. Now the user has updated some of the items inside one of the nested dictionaries. The user clicks save. Now what? You've got to get that change to the data in the dictionary inserted into the correct place in the relational database. You're going to write code to do by hand what an ORM wants to do for you.