Hacker News new | ask | show | jobs
by wegs 1951 days ago
I make my own abstractions. I might have a file called 'kvs' which implements a key-value-store abstraction, or one called 'friendnet' which implements a graph of social relations.

* Those files have all the SQL. I never have raw SQL in my main application.

* Those files never e.g. call into my web framework, have HTML, or otherwise. They're a stand-along abstraction.

An ORM mutates a good abstraction (SQL) into a not-as-good one. Making a generic abstraction which works everywhere is hard, and SQL is the best one we've got. By making it domain-specific, we can mutate it into a good one.

One of the key principles I use is to try to have more than one back-end. For some (like a kvs), that might be Elasticache AND in-memory AND postgres. For something relational, it might be postgres and sqlite.