81 points · by jurre · 14y ago · 29 comments
Thoughts on this? Is there room for innovation in APIs via DSLs?
I am imagining DSLs being useful both on the server side and the client side. For the former, imagine sending off a single query instead of doing a bunch of different API calls. For the latter, well, JQuery is an existing example of a popular client-side DSL (technically it's not, but it feels that way).
For example, take a look at how easy it is to implement BrainF inside Racket, a lisp focused on language experimentation. http://hashcollision.org/brainfudge/ I bet you could walk through these steps in maybe half an hour with little to no prior experience.
Granted it expands to more than one line, but I'm not seeing that as a good example of lisp's superiority.
It should be fairly obvious that you're quite likely to now have pain points in serialising and deserialising that much JSON.
It seems to me that you now have 2 choices:
1) You forget this approach and instead perform REST composition and aggregation by adding a datastore in the composition/aggregation service to reduce the number of calls to the back end.
2) You ditch the internal REST services and change to using protocol buffers or something else to remove the JSON bottle neck internally.
Either of which will make ql.io redundent.
ql.io appears to be trying to solve REST as the language of enterprise services, without using a service bus or BPEL to aid with composition or aggregation.
I agree there is a problem space here, and whilst I have an immense amount of respect for Subbu (worked on ql.io, authored REST book) I'm unconvinced that this approach is the solution to the problem.
1. a nice, object-oriented hierarchical RESTful interface for standard queries and getting started e.g. /api/user/12345/friends/
2. a sql-esque query language interface for arbitrary, complicated requests e.g. /api/?q=select id from users where name="Joe"
It looks like ql.io could be a good way to provide the latter.