2 ms·
I too prefer the jax-rs annotation style, but this is definitely by design on part of the Spark project. It emulates Sinatra for Ruby, which takes that 'clean'
by chamakits 12y ago
I too prefer the jax-rs annotation style, but this is definitely by design on part of the Spark project.
It emulates Sinatra for Ruby, which takes that 'clean' approach of doing things simply and predictably. You can very quickly understand how to use annotations with jax-rs. But that's declarative. You annotate your code, and understand that the framework will take care of the rest. This is great for fully built complex frameworks. The problem is, that with annotations you are marking something in a very ambiguous way that can be used by the framework in any way. Its easy to understand, but from just reading the code, you can't really know HOW the annotation is being used.
Sinatra/Spark on the other hand are much more imperative. You need to assume very little about what the code actually does, as you are imperatively building exactly the way you'll be listening to requests, without having to know anything of how the framework is going to interpret anything. It's much more direct in what you wrote mapping to a very specific predictable set of actions, determined by the language, not so much the framework.
Two separate ways of thinking/styles that are happy to live separately making people happy in different ways.