I've been reading a lot of hate spewed on ORMs, and am genuinely interested in finding out if there is a better way of doing things.
Unfortunately, while there are tons of books, blog posts, and articles about modeling and building apps using various ORMs, none exist for the non-ORM approach.
Are there any mid/large sized open source webapps built without an ORM? Nothing beats reading actual source code.
Alternatively, here's what I'm trying to find out:
- just because you aren't using an ORM, various associations between tables don't disappear. How do you model them in your app?
- For simple stuff like loading a row given the PK, how much boilerplate does one have to write? Are there any libraries that ease this pain?
- For simple stuff like loading 1:many associations, how much boilerplate is required?
- What does the code look like, when you're exposing a JSON API in your web app? The JSON API will inherently have associations in it (I.e. User JSON will have Posts inside it, which will have Comments inside it). How is this materially different from what an ORM does?
- What does the low-level API, which implements various business logic, look like? If not objects, what arguments does this API take? What does it return?
My exposure to ORMs is only via Rails/ActiveRecord, and I can't visualise myself writing a DB backed application without duplicating all the boilerplate that Rails takes care of, for me. It could be that hibernate or nhibernate are different beasts and active record is just fine. Which would actually make sense and lay this matter to rest. At least for me.