Monday, May 14, 2012

Jogger design decisions FAQ

Jogger is a lightweight library for building Web Applications that provides a routing mechanism and a view template engine based on FreeMarker. The source and documentation are on Github.

In this post, however, I would like to answer some questions about design decisions I made with Jogger that will help you understand the philosophy behind.

Why do we need another Java Web Framework?

I wanted a super simple Java web framework that would allow me to:
  • Map HTTP requests to Java methods: similar to Play! Framework (which is inspired by Ruby on Rails).
  • Use a better request/response API than the one provided by the Servlet API.
  • Define views and layouts: reuse layouts in multiple views.
  • Plug into any project: let me choose the project structure and the libraries/frameworks I want to use; don’t make this hard on me.
  • Deploy into any Servlet Container: such as Jetty or Tomcat.
  • Easy testing: test controllers and views without having to start a Servlet Container.

Why not a component based framework like JSF, Wicket, etc.?

Short answer is that they couldn't keep the promise of isolating the user from client side development and the request/response nature of HTTP. Long answer is here.

Why not using the Servlet API directly?

Because it sucks! It's difficult to test, it has an endless hierarchy of classes, exposes hundreds of useless methods and provides an inconvenient configuration mechanism. The only good part is that it doesn't try to hide the request/response nature of HTTP.

Why using FreeMarker for the view?

JSP's (Java Server Pages) were dismissed from the beginning, you just can't create and reuse a layout with them. My first options were Jade and Haml but there is not a decent implementation for Java that I know. The truth is that I am happy with FreeMarker now.

Why not using annotations instead of the routes.config file?

First, with annotations you would have all this routing configuration scattered in multiple Java files. I wanted to keep this information centralized and as simple as I could. Second, I'm against of scanning the classpath (one of the reasons I moved away from JEE), it just doesn't scale. Third, it would be a problem for hot deployment.

Why exposing the Jogger Request and Response in the controller actions?

Because I think we should embrace the fact that HTTP is a request/response protocol. You retrieve things from the request and use the response to, well, respond.

Why testing without starting a Servlet Container?

First, it's an unnecessary overhead. Besides, you wan't to test that your routing is working as expected, that your controller is rendering the correct template, etc. and I think that mocking the Servlet Container works well in this cases. It really depends on how you need to test your application.

If you have another question or think that an answer is not clear enough, ping me and I will add it or improve it. Thanks.


Andres Felipe Peña Castro said...

Chevere. No habia visto tu blog. Saludos!

Alex Serov said...

Hey German!

There is one super-simple (but pretty powerful) java Web Framework that may serve as a starting point for developing the framework of your dream. See

Germán Escobar said...

Alex, thanks for the link. Did you developed it?

Alex Serov said...

Hi German!

To a certain extent - yes. As of today the project is a bit in limbo: all interesting from scientific point problems are resolved. Maybe you will add some suggestion?

Other things (maybe more banal but still necessary, like plug-in for eclipse) would need some money investment to develop. So far the latter not seen around.

Germán Escobar said...

You don't need money to develop. If you want to do it, you will find the time and energy. I really can't understand what problem you are trying to solve. It looks really complex solution and, again, you are trying to isolate the programmer from the request/response nature of HTTP. Don't hide it, embrace it! This is what Jogger is really about ;)

Jacob Manco said...

If really know how to play in that field, indeed that money is not the only thing that is important. There are a lot of things to consider. Glad you have this posted. Thanks.

Pnane Weg said...

air jordan 12
prada sunglasses
burberry sale
michael kors bags
burberry outlet
nike discount
clarks outlet
ferragamo sale
vans shoes
north face coat
coach bags sale
michael kors outlet online sale
coach handbags
nike high heels online
hermes belt
joe's new balance
columbia outlet store
air jordan 14
canada goose cheap
salvatore ferragamo outlet
christian louboutin shoes
cheap rolex watches
reebok outlet
north face coats for women
oakley sunglasses
jordan 11
celine bag
salomon boots
cheap gucci shoes
ralph lauren clearance
jordan shoes
coach purses outlet
michael kors handbags clearance outlet
cheap canada goose coats
polo factory store
jordan 6
coach factory outlet
wholesale nike
kids jordans
hermes bags
abercrombie outlet
ghd flat iron

Pnane Weg said...

1ugg boots on sale 70% off
michael kors handbags outlet stores
north face factory outlet
burberry scarf outlet
gucci outlet
michael kors bags
all jordan shoes
canada goose clearance
coach handbags outlet
cheap converse shoes
kobe shoes
coach handbags outlet
nike outlet store online
air max 2015
nike running
coach outlet store online clearances
coach wallets
abercrombie outlet online
hermes outlet online
fitflop sandals
oakley sunglasses
jordan 3
hermes birkin
kate spade sale
michael kors handbags
ugg boots sale
jordans for sale
michael kors outlet store
celine bags
gucci sunglasses
nike free 5.0
hermes birkin bag
jordan 13
columbia sportswear
michael kors handbags
michael kors outlet
air jordan 13 retro
burberry sale
celine bags
cheap north face jackets
supra shoes
supra for sale

Anna said...

Great and Useful Article.

J2EE Training

Java EE course

Java EE training

J2EE training in chennai

Java J2EE Training Institutes in Chennai

Java J2EE Training in Chennai

Java EE training

Java Interview Questions

Post a Comment