Skip to main content

JSF or GWT?

I have worked with JSF for almost 4 years. First time when I had a chance to work with GWT, I was very excited. Like many Java developers I was like 'Wow I don't need to play with those bloody tags and elements and now it's pure Java code!!!'... I was so happy but my happiness didn't last very long.

Programming is my passion. I hate writing codes that become a mess later and unfortunately this is what will eventually happen with GWT.

The thing is you can't rely on reviews and features of a software or an API, in action everything goes different way. Specially when it comes to large scaled application and in an environement where everything is urgent and importnat... well, I think all software companies are the same in this regard...

The fact is that in a team of developers not every one cares about best practices, design patterns and even if you have very experienced designer, solution architect etc, still you can't force the team to develop a well-designed software. So what?

The answer is "a good framework is the solution". A good framework not necessarily means an easy to use nor a fast development environment. Business owners consider these as the best features for a framework but we miss the facts that:
  • A software will be grown just like branches of a tree
  • Business logics are not always the same for different clients and nobody wants to manage multiple branches/versions of the same software for different clients.
  • When a software is big enough, changing any part of it costs the company a lot of money and time.

And of course many other facts but we should be aware that it's almost impossible to achieve all of these and yet to have a fast and easy framework to work on! 

So what is a good framework? A good framework in my opinion:
  • Forces developers to create a well-structured application while they are still free to break the rules and go off the road.
  • When it comes to a critical issue where nobody has any idea about it, it's easier to track down the culprit without even debuging the code and debuging makes it much more easier.
  • To find out what's happening for a particular finction and what's behind the scene, a developer (particularly those other than the person who created the code) doesn't have to look at a dozen of classes and find their usages in other area, instead everything is clear!

.... And yes again many other facts...

Now going back to the title of this post, JSF and JBoss Seam have a lot of critisism and so does GWT. If we read reviews from experts about GWT and JSF, we will end up in GWT as a good framework (however this doesn't mean there is no good review about JSF),

BUT in action:
  • When it comes to a large application with strange complexities and rules that don't make sense from programming point of view yet they are crucial for clients. 
  • When it comes to time restriction and urgency of tasks and the horrible stress for developers
  • When it comes to a point where everyone tells you "Don't worry about the design and those bullshits just get it done quickly for the next release."
  • When it comes to a strange bug in code where everyone blames the others and nobody knows what to do and managers ask everybody, including people in HR, to stay overnight and test and find the problem.
.... And of course, when it comes to a web application in Java, then you would appreciate JSF and JBoss Seam and you would embrace the bloody non-java tags and elements by JSF as opposed to shiny attractive Java code of GWT.

If you are a JSF developer and never worked with GWT, then you probably disagree but to me, GWT is created to hide the complexity of javascript and HTML mess while the final product is a nightmare.
Just look at a class in GWT and you'll see a handful of asynchronos calls that not only look aweful but also difficult to read.
You can see everywhere events/listeners and fatty-several-meters-long asynchronos calls are pouring like cats and dogs.

Reusing a functionality or a web page as a component is not easy in GWT. To do so you hve to sacrifice simplicity and you will end up with another sackful of codes.

Based on my experience with both, I believe the combination of JSF, JBoss Seam and JQuery works extremely well to develop a large scale application.  It also much easier to find a bug and reuse a page in other area.

It is very flexible so you can easily modify/remove/add a component in JSF with less side effect in other area in order to improve performance or functionality or to enhance it. While in GWT, changing a small peice of code may cause other part of application, that you never expect, to break.




I have to say I prefer awkward AJAX calls from JSF rather than messy RPC calls of GWT.
I also prefer clumsy disgusting tags and elements in JSF and not illusive-Java-code-as-html feature of GWT. (Don't get me wrong, I always hated front-end programming and never been interested. Like most of developers I love back-end programming but as a developer you have to work with both).

Comments

Sivatheja said…
Thanks from bottom of my heart! Was confused on choosing JSF vs GWT, this definitely got me thinnking.
Thinker said…
You're very welcome :)
Anonymous said…
Confused of what to choose between JSF & GWT, but this certainly helps to decide
Thanks
Samy Omar said…
Thanks a million for this great article, you explained the case very clearly.
I agree with you 100% percent.
Obviously the author may not had a chance of using GWT for a complex web application(where it revels). Getting to the real deal, here is an example. GWT provides out of box advance components, one which is my favorite called DataGrid which can have custom editable cell editors, a kind of Excel on browser thing.So as a user I can lazily sprint around the grid updating randomly the cells values , as well as inserting/deleting new rows. Then in the end click Save to commit all changes with one call to the JEE backed stack comprising of Hibernate and Spring. All this is done in Java, no dabbling in heterogeneous technologies, API's like Seam, Jquery or JavaScript. Furthermore if one uses the GWT standard MVP, Activity and Places framework as well as UIBinders, you do not get loss in labyrinth of huge code for a large project.
Thinker said…
I've been working with GWT in a very complex software and it's almost 2 years now. In fact, if you read this article I mentioned that GWT works fine in simple application but not large scaled systems. The software company that I am working with still using GWT and we still have problems with maintenance and performance. We are not talking about which one has a good component and which one has not. This is about software design and complexity that underlying frameworks create. As I said in the article, when you work in a big project with more than 10 people working on it, this becomes a nightmare in GWT because it allows anyone does anything in any way... and that's one reason it's not a good idea to use this framework in Enterprise applications.
Unknown said…
perfect explanation, thanks.
Edd said…
I started working in a GWT program after a lot of years working in JSF, and I completely hate it. I Can't understand why GWT do the thing it does, but it's completely different from JSF, and it's horrybly complex.

If somebody ask me I will entirely recommend JSF.