4 ms·
That sure looks nice, but how often do you write services which return a single constant string? I like to judge languages/frameworks based on more representati
by butteroverflow 7y ago
That sure looks nice, but how often do you write services which return a single constant string? I like to judge languages/frameworks based on more representative snippets.
- unscaled 7y agoI think this is not about showing off the easy case, but rather the straightforwardness of the framework. I haven't used spark myself, but I used frameworks quite like it (Jooby, Rapidoid, Ktor) in Java, as well their counterparts in Nodejs (Express, Koa) and Go ("net/http" + some router). The applications certainly got a lot more complex than that, but we never found ourselves in need of a magic annotation that you can't step through with your debugger. This is all about simplicity. It's pretty clear how a get() function on the router which takes a route and a callback works, but it requires some work to understand how Spring magically scans all your classes looking for annotations and then builds parser based on that. It's quite unclear where all of the routes are coming from (since they can come from a class just about anywhere). You suddenly need special tools. And the worst thing that suffers is transparency. Ctrl-clicking/Cmd-clicking on an annotation in your favourite IDE never tells you what it does. In comparison, a second-order function is a vastly simpler and more grkoable beast.
- Nursie 7y ago> That sure looks nice, but how often do you write services which return a single constant string? The point was just to show that the http server aspect of it is trivial to set up. You can hook in whatever you want from there.
- Nursie 7y agoFYI, the "(a, b) -> Hello World" piece is a lambda returning a string constant, rather than just a string constant, hence the ability to hook in whatever you want.