▲ | foolserrandboy 4 days ago | |||||||
I wonder why it’s not the norm to use code generation or some other form of meta programming to handle this boring repetitive work? | ||||||||
▲ | stavros 4 days ago | parent | next [-] | |||||||
Because, like a carpenter doesn't always make the same table, but can be tired of always making tables, I don't always write the exact same CRUD endpoints, but am tired of always writing CRUD endpoints. | ||||||||
| ||||||||
▲ | Cthulhu_ 3 days ago | parent | prev | next [-] | |||||||
Because in practice the API endpoint isn't what takes up the time or LOC, but what's underneath. In fact, there's plenty of solutions to e.g. expose your database / data storage through an API directly. But that's rarely what you really want. | ||||||||
▲ | iterateoften 3 days ago | parent | prev [-] | |||||||
Leaky abstractions. Lots of meta programming frameworks tried to do this over the years (take out as much crud as possible) but it always ends up that there is some edge case your unique program needs that isn’t handled and then it is a mess to try to hack the meta programming aspects to add what you need. Think of all the hundreds of frameworks that try to add an automatic REST API to a database table, but then you need permissions, domain specific logic, special views, etc, etc. and it ends up just easier to write it yourself. If you can imagine an evolutionary function of noabstraction -> total abstraction oscilating overtime, the current batch of frameworks like Django and others are roughly the local maxima that was settled on. Enough to do what you need, but doesn’t do too much so its easy to customize to your use case. |