New ask Hacker News story: Ask HN: Why aren't code generator ORMs more popular?

Ask HN: Why aren't code generator ORMs more popular?
3 by travisjungroth | 0 comments on Hacker News.
Some people like Object Relational Mappers. Some people do not. I'm definitely an ORM user. Writing active_users = User.objects.filter(active=True) is nice. Writing that SQL query and then turning the result into a User object seems like such a repetitive task that I should be using code to solve it. I get the other side, though. When things are more complex and they go wrong, figuring out what magic has broken isn't fun. That little .filter() is dependent on hundreds or thousands of lines of code. I'd much rather just look at a SQL query. And I can do that in most ORMs, but since it's created dynamically, maybe it changes in weird ways. What about a code generator? Not in the dynamic sense, but something that just generates code which I copy into my codebase. Maybe as a function. That generated code is then unaffected by changes in the ORM. That could be good or bad, but it's certainly different. Maybe the "repetitive task" that my coding brain is trying to get me out of isn't the SQL query and marshalling, but the writing of the SQL and marshalling code. Maybe I should just automate that. I'm sure this isn't a new idea. But, I consider myself pretty in-the-loop and haven't seen it done before. Since other people are pretty smart too, it seems like there should be a reason. Anyone know why this isn't a popular way to do things?

Comments