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.

17 comments:

fepecas 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 http://www.hybridserverpages.com/

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...

Alex,
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.

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

Mehmet Ali Erbil said...

no deposit bonus forex 2021 - takipçi satın al - takipçi satın al - takipçi satın al - takipcialdim.com/tiktok-takipci-satin-al/ - instagram beğeni satın al - instagram beğeni satın al - google haritalara yer ekleme - btcturk - tiktok izlenme satın al - sms onay - youtube izlenme satın al - google haritalara yer ekleme - no deposit bonus forex 2021 - tiktok jeton hilesi - tiktok beğeni satın al - binance - takipçi satın al - uc satın al - finanspedia.com - sms onay - sms onay - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - perde modelleri - instagram takipçi satın al - instagram takipçi satın al - cami avizesi - marsbahis

Anonymous said...

perde modelleri
NUMARA ONAY
Türk telekom mobil ödeme bozdurma
nft nasıl alınır
ankara evden eve nakliyat
Trafik sigortasi
DEDEKTÖR
Kurma Websitesi
AŞK ROMANLARI

Anonymous said...

smm panel
smm panel
iş ilanları
İnstagram takipçi satın al
HİRDAVATCİ
beyazesyateknikservisi.com.tr
SERVİS
tiktok jeton hilesi

mrbahis said...

Good content. You write beautiful things.
mrbahis
sportsbet
hacklink
hacklink
taksi
korsan taksi
sportsbet
vbet
vbet

eren said...

kocaeli
konya
kuşadası
kütahya
malatya
TYHW

veysel said...

başakşehir
beykoz
gölcük
kütahya
bandırma

PEC8A

mrHaldun said...

Denizli
Ankara
Antep
Bursa
Eskişehir
ZDS

CelestialCipherXY12 said...

ankara parça eşya taşıma
takipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
UQYNPF

21BA1Immanuel27969 said...

53285
order trenbolone enanthate
sustanon
steroid cycles
Tekirdağ Boya Ustası
deca durabolin for sale
order testosterone propionat
order clenbuterol
buy trenbolone enanthate
order fat burner

DA161Xiomara37FE5 said...

F1072
ledger
trezor
trezor
wallet bitbox
ledger wallet web
ledger desktop
ledger web
avax wallet
web eigenlayer wallet

Post a Comment