Tuesday, September 24, 2013

Google Web Toolkit, Why?


Ok, I get it, I really liked the idea of Google Web toolkit way back when, when browsers where stupid, but do we really still need it?

My answer is simply no, in a world where things like angular and REST exists I really don’t seem to find a use for it anymore. Going by the official documents surrounding architecture in GWT the initial startup for getting a simple page rendering is insane compare to straight HTML.

To start the process you have to remember that GWT compiles Java to javascript, so we need a JDK installation and Java IDE. Anyone had to ask a designer to go through all of this?  They hate GWT just for this. Ok so we followed all the guides and got our environment setup. Now for the second problem GWT until recently has never followed the java community in terms of build and development process, they only recently have come around to using maven for their processes.  Third point getting this setup with maven to work at the moment is a real issue and lastly the process of building the project is very, very slow.

Ok so we finally got a building project, now what, well firstly there is the problem of competing architectures, the GWT way was to try and mimic android with activities, except that GWT-P is a part of the new GWT steering comity, so which one do I use? Well it really doesn’t matter they both end up bloating your project with lots of code I don’t want to deal with.  Talking about bloat how about dealing with the idea of JSNI.  I used JSNI objects to send and receive JSON REST information, I ended up dealing with server side DTO objects and client side DTO object, I think this kinda defeats the purpose of reusable code. Yes yes I know about the constructing bean vs proxy class thing, still to much code and not very usable. Using JSNI makes parsing an using complex data structures so much easier to use in views.

On the subject of views, why do I not have some sort of control logic in views like repeating the same DOM structure for a given list. Instead I have to bloat my activity or presenter with this, or create a view class bloating my code even more or the sake of unit tests.  Really, unit tests have that much impact on code architecture? when did this become thing?  Horrible.

Now enter something like angular, it uses conventions or tries to use conventions that are or are becoming very popular and standardised, its easier to develop with, unit testable(without messing up or bloat the code base) and designer friendly(this is a bigger thing them most people realise).  It uses MVP pattern the same as GWT but does not take forever to compile and it’s not as bloated. Angular can be made to play much more nicely than GWT with other well develop and very useful javascript libraries, heck it comes with mini jQuery library.

All and all my development time spent with both of those pushed my so far down the angular path that hopefully I will soon stop having nightmares about GWT and some of the stuff I had to do in order to be productive.  I get that Angular can have it’s issues but if you are developing to a modern browser like most people doing SPA application on the chrome store these days Angular is so much easier and for the most part it still works fine with other browsers(IE ... cough).

Please use Angular! :)

No comments:

Post a Comment