Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Syntax 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!";
           }
        });
     }
  }


You 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

Not micro: 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.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: