I don't know what exactly the complaint is here. You don't like that Rails has a common structure?
> It's virtually impossible to swap AR out for anything else.
I've used Mongo and a number of other ORM's, why can you not use other ORM's exactly?
This just sounds like you don't like frameworks and want to build things from the ground up, because most of the complaints you make are just not true. Maybe you are just inexperienced with Rails because you can swap out almost anything.
because behavior is an unspoken part of contracts.
I can't reasonably swap out an array with a linked list even if the official contracts are the same.
this is why things like DAL's are created, they give you an opportunity to deal with the differences in behavior.
The issue with frameworks like RoR that use AR throughout is that the queries are sprinkled throughout the codebase, giving no opportunity to fix such behavioral differences.
What happens is every ORM then attempts some sort of "query reuse" and they do so badly because it's not possible to do it well with the contracts they expose. It creates code where you can't ever reason about the query that's actually being generated.
What kinds of queries are sprinkled throughout that are not part of AR, or depend on AR?
Sure, if you are going to swap out AR for another ORM in the middle of an established project you are going to have a bad time, but if one is doing that I have larger questions.
I wasn't saying that we want to swap it out in the middle of an established project, but that it's impossible to do so in a greenfield project too.
there's MongoID and it's OK-ish, -a brilliant piece of work though!- but not particularly good inside Rails yet the best alternative example there is. Yet with this (naturally) many gems won't work either. Everything in the community simply presumes Rails' AR is always there. Because it practically always is.
ROM-rb, and Sequal all attempted to be "plugin replacements" but the author of the first rage-quitted at some point exacly because Rails (the dev team) refused some compromises or even abstractions that would allow swapping AR out for something that fits SomeProject better, at the start.
I must be misunderstanding the question because anything that queries in rails uses AR and that's often done in both lib code and controller code rather than behind a dedicated module boundary.
> because anything that queries in rails uses AR and that's often done in both lib code and controller code
How is that different from any other framework ever? You have to query the DB somewhere. Rails makes it incredibly easy to swap out databases. Much more so than any other platform I can think of.
Nothing is making you use AR at all. This is a non issue.
> It's virtually impossible to swap AR out for anything else.
I've used Mongo and a number of other ORM's, why can you not use other ORM's exactly?
This just sounds like you don't like frameworks and want to build things from the ground up, because most of the complaints you make are just not true. Maybe you are just inexperienced with Rails because you can swap out almost anything.