3 ms·
These are the types APIs that I CONSTANTLY have to tell our internal guys "Hey, don't do that!" I get WHY you'd want to be able to throw in any random filter/s
by cogman10 6y ago
These are the types APIs that I CONSTANTLY have to tell our internal guys "Hey, don't do that!"
I get WHY you'd want to be able to throw in any random filter/sort to get the exact datapoints you are after, but that's both really hard to scale and often ends up being highly coupled to the underlying datastore.
I get it, requirements gathering and making a clean API is hard and time consuming. What's harder is not doing that and needing to eventually figure out "How on earth can I get constant response times or stop someone from sending an app crashing query all while supporting current usages".
- lostcolony 6y agoYeah; reading this the only 'gain' I saw was "we don't have to define an API". But instead you get to try and ensure that raw SQL from the client is always safe. The former isn't THAT hard to do. The latter is extraordinarily hard. Get the former wrong and you fix it before it ever goes live. Get the latter wrong and you fix it only after you're massively pwned. This is just a bad tradeoff.
- cogman10 6y agoAgreed. The issue is it's "easy" to do if you have a massive data model and can feel pretty fun making a query-able API. What's more fun? Making your own DSL or writing a billion "/foo/{id}" endpoints. Usually the DSL is a lot more fun and rewarding, however, "/foo/{id}" is a FAR more stable and easy to maintain API. That's where I've often run into the problem. When someone wants to make a monolith into a more microservice thing the hard part of carving out monolith usages takes meetings with consumers. Devs don't want a bunch of meetings and requirements gathering and a lot (at least in my org... :( ) would rather just write something cool and throw their hands up and say "We don't know how you'd use this, so we made you the boss".
- dvdkon 6y agoA lot of internal enterprise tools explicitly have "filter everything" as a feature, so in those cases you might as well use a super-generic API, since you'll need that flexibility anyway.