Saturday, October 28, 2017

Direct SQL querying

I’m not sure what the answer for this is, exactly.  API design is hard.  But I’ve noticed something about the way our code works:

We write SQL queries all the time.  They’re highly optimized—each one is purpose-built for the task it needs to accomplish—but each one also intimately knows the database structure.  It’s like our database is Gulliver, and each query embedded in our code is a Lilliputian rope across it.  The more code that the business (inevitably) accumulates around the database, the harder it is for the database to move.