4 ms·
All the nesting and redundancy come from Java itself. Verbose as it may be, after you use any language for a while you will see right through the syntax and it
by tga 13y ago
All the nesting and redundancy come from Java itself. Verbose as it may be, after you use any language for a while you will see right through the syntax and it will not add (much) cognitive load to your work.
I think the value here is in having a micro framework that allows you to put together a web app without having to juggle a horribly complex abstraction hierarchy for even the simplest of tasks.
- hawleyal 13y agoSyntax is what makes the framework micro. Following your point about the cruft being from the language, Spring MVC is as "micro" as Spark. In fact, it is shorter. Spring MVC: @Controller public class HelloController { @RequestMapping(value = "/hello", method = RequestMethod.GET) public @ResponseBody String hello() { return "Hello World!"; } } Spark: public class HelloWorld { public static void main(String[] args) { get(new Route("/hello") { @Override public Object handle(Request request, Response response) { return "Hello World!"; } }); } }
- tga 13y agoYou don't call a framework "micro" based on the amount of code it takes to achieve certain tasks. You call it "micro" because it's small enough that you can learn and truly master in a short time (and you get that by cutting out as many non-essential features as possible). Therefore, Micro: http://www.sparkjava.com/readme.html http://www.sparkjava.com/readme.html Not micro: http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/ http://docs.spring.io/spring/docs/3.2.x/spring-framework-ref... The downside when using a micro framework is that you always walk a fine line between simplicity and code reuse. Because of this, as the application grows you do end up writing more code than with a complex framework because you slowly start reinventing the wheel -- this is the old argument you hear over and over (Flask vs Django, Sinatra vs Rails, BackboneJS vs AngularJS, etc.)
- crucini 13y ago> All the nesting and redundancy come from Java itself Hmm. How about: public String GET_hello(Request req) { return "Hello World"; } The framework would use reflection to build the routing map.