Re: [angular.js] Re: When is GWT appropriate, when is AngularJS appropriate?

13,755 views
Skip to first unread message

Christopher Oman

unread,
Jul 12, 2012, 1:56:47 PM7/12/12
to ang...@googlegroups.com
Wow. Great post. Obviously you have been thinking about this a lot. Thanks for writing this up. It's very, very helpful.

On Thu, Jul 12, 2012 at 1:14 PM, Adam Bender <adamb...@gmail.com> wrote:
First to establish my perspective with these technologies - I write Java and Javascript professionally, I have used GWT off and on since its inception and most recently have been full time on a GWT project for the last 2.5 years. In addition I have been writing Angular apps since version 0.9 something. So generally speaking I have used GWT a lot more, but then again it has been around a lot longer. You asked for a comparison of when to use each so here is a list of pros and cons that I see with each.

GWT Pros:

* Mature, well tested, highly engineered solution for producing pure client side applications.

* Lot of examples/documentation/support available

* Highly efficient/performant, both in terms of app delivery size and runtime performance (they now even benefit from the closure compiler)

* Written using staticly-typed, well tooled language. In my case this is important as our app is safety critical (people can die if it screws up) so the idea that we have the compiler checking for a class of errors means one less set of tests I have to write.

* Great Development environment that makes you productive even though you have a compile step in your build

* The ability to use Google Guava library. Don't underestimate the power of having robust utility libraries to do things like argument assertions, collection traversal, exotic data structures etc. There really is nothing better than Guava when it comes to this kind of stuff. Of course because Guava is used by the GWT dev team it means that you dont have to worry about it surviving the JRE emulation - it will just work!

* The single greatest thing about GWT for me was the programming model of Activities and Places - more commonly known as Model, View, Presenter (MVP). This programming model is a perfect fit for web application in particular where you may want to reuse logic to power different shaped views (read phone, tablet, laptop etc.). GWT really embraced this pattern to great effect 


GWT Cons:

* It's still Java. No matter how you slice it, and how ironic it is, Java just isn't web-ui friendly. Java is not a good choice for anything programming problem that involves a lot of click handlers, or one-off listeners. Anonymous Inner Classes are just not the right way to do it!

* Even with the speed ups you have to avoid compiling as much as possible. On my laptop (late-model quad core mac book pro) compile times range into the 2 - 3 minutes time frame. It is twice as slow on a dual core machine. That really is a long time to wait between making changes and seeing a result. Even though the GWT team have done a great job making compilation less necessary during day-to-day development it's still manages to suck time out of my dev cycle. Also, like taxes and my waist - compile times only seem to grow with time.

* Adapting 3rd party libraries is possible, but not fun and you end up writing this weird mix of "javascript-in-java multi-line comments" which never seems to format correctly in IDEs and is completely opaque to syntax highlighting apparently. 

* GWT applications cant support dynamic module loading easily. Think of a portal like iGoogle where you want to include many modules, perhaps only determining which ones at run time. GWT will fight you every step of the way because GWT, due to the extreme optimization it does, likes everything in the world to be known at compile time. This means that you can't link code up in the browser which means you lose out on what I think is one of the greatest features of the web.

* Related to that last point, GWT is not very modular in and of itself. While there is the ability to do code splitting to improve load times, you still end up sucking down a lot of GWT library stuff for even the simplest hello world app. Now this may or may not matter to you, but if you have mobile dev in mind, every byte counts!


Angular Pros:

* Angular is "of the web" It embraces core web technologies and make it easy to write your app using standards.

* JavaScript is a great language for UIs. I find that the Functional/OO duality of JavaScript makes it a great target UI development.

* Angular - owing if I recall correctly to it's Flex influence - has a fantastic programming model with binding, DI, promises, and Dumb views. Some might call it a MVVM approach, but it still seems like MVP to me and so just like I loved it with GWT I also love it with Angular.

* The use of the MVP model also help mitigate the traditional problem with JavaScript apps. Namely that they become impossible to manage at a certain size. By keeping things contained in small controller/service/directive buckets you have a clean way to manage your applications growth.

* Integration with 3rd party libraries is a snap thanks to the public exposure of $apply and $digest. You can actually improve other libraries by extending binding capability directly to them using core Angular methods.

* Angular is nice a modular framework and works to build small apps all the way up to multi 10s of thousands lines apps - don't know about anything bigger than that cause I havent worked with it but I think it should work.

* Angular has a healthy and vibrant community where any question you have can be answered pretty quickly.

* Testability, testability, testability! If you are going to write code in a dynamically typed language then you have to have a fantastic tests story and Angular has created one. Both due to it's use of core test-enabling patterns like DI but also through the development of the Scenario Tester that lets me write Selenium style end-to-end tests using JavaScript as my language of choice.


Angular Cons:

* JavaScript is a notoriously difficult language to manage large teams and projects in. Its great strength as a flexible, almost assembly code of the web, is also the source of many problems when people do simple things like rename a variable or use constructs like  - obj[a ? "en" : "dis" + "able"]()  - As I mentioned before I think Angular can help a lot with the marco organization problem and even some of the micro code issues, however it is still JavaScript and it is possible to make a serious mess. Note that tooling is getting better especially in Intellij/WebStorm so perhaps these kinds of issues wont be a problem for long.

* Angular is new in a crowded space. Although I believe it is the first framework to truly get what is required to build "Application in the Browser". It remains to be seen whether enough mind share can be established to create a growing and sustainable community - one that shines in the face of a fickle JavaScript development community.

* Part of being a young project means the docs and examples out there aren't quite polished down which can be quite annoying. However, this problem is getting better by the day and as far as I am concerned Angular has exceptional docs given it's limited exposure to public consumption.

* Angular has been knocked for its dirty-checking for binding approach. While I cant comment on the alternatives to much I think for the most part this is a non-issue for most apps but you'd have to evaluate your applications binding needs.


Bottom Line:

If you have only Java developers - use GWT. If you would prefer to have a compiler help catch some, but by no means all human errors - use GWT. If you need to rely on extensive examples or documentation, for now GWT is better but that will change. If it is going to be a very large, long lived application - something static typing an the Java tooling ecosystem may help with then GWT is your option.

However, if you want to build apps from small to large and you are comfortable with JavaScript as a programming language - not just a way to make animated transitions - then Angular is the first framework to give you the power to build a proper application. One where  you stop thinking about the incidental complexity and can therefore focus on the essential complexity. With Angular you can be as big or small as you want, as dynamic as you want and really use the web to its fullest potential. Don't forget that the JavaScript tooling ecosystem is getting better every day- I can even put my JS app in Sonar now, build it with maven, run JSHint in my IDE and more. So the days of JavaScript being considered a toy language which no real project can be done in are long gone. Using Angular you can really put the lie to that line of argument.

Personally, having discovered Angular I don't think I would ever recommend GWT as a place to start for a web app. While GWT represents a truly amazing engineering success, I think it is an idea whose time has come and gone. I look forward to a future building AngularJS apps and solving problems for customers in a way that not only makes them happy, but keeps me from wanting to know my finger tips off!



Sorry for the long post, but this is something I have had to argue both ways with clients as well as internals teams so by writing it down here, I can point them to this post and save my breath.

Adam

On Wednesday, July 11, 2012 6:14:50 AM UTC-6, Chris Oman wrote:
Both of these technologies seem to fill the same space, but coming at it from different angles. Has anyone done a comparison between the two and developed a synopsis of when best to use each one?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/LDlePhuF5TsJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Travis De Silva

unread,
Sep 1, 2012, 2:06:33 AM9/1/12
to ang...@googlegroups.com
Thanks Adam for this. This is really useful. 

Have you done any reasonably mid size application using angular that works with all the major browsers including IE8 and above? Did you have any major pain points that made you go back to GWT?

Travis

geraldodev

unread,
Sep 1, 2012, 10:24:33 AM9/1/12
to ang...@googlegroups.com
For more than a year, I tried to use gwt to make database web application.
I found myself using ruby to generate GWT code. Lots of code.
When someone says gwt is java I disagree. 
The java reflection system isn't mapped in gwt, because it's goal of ultimate code optimization.
So if you want to make something generic you'll end up with some sort of code generation.
That (imho) hurts productivity !
I'm so glad that Elco Hillenius(creator of wicket) tweeted about angularjs. 

Simple and yet powerful data binding, one layer above jquery relieving me from nasty dom manipulation for mundane tasks, and a widget system that I can use.

Vural A.

unread,
Mar 2, 2013, 1:48:42 PM3/2/13
to ang...@googlegroups.com
This post is quite old but I still want to answer. 

I already have programmed a very large application with AngularJS, which works great on (gte) IE7+ and all other browsers. Used WebSocket/AngularJS and some other frameworks together. 

AngularJS works well on IE7 and IE7+

David Yu

unread,
Mar 3, 2013, 1:40:14 AM3/3/13
to ang...@googlegroups.com
Here's my experience:
I started coding using GWT for a client who preferred that it be used in 2007.  I initially liked it then after the app got larger, the compile process took its toll on me.
By 2008, I ventured to using javascript with jquery.  No compile step, do more with lesser code.
The downside is that if the app gets larger, it is more difficult to maintain because of the lack of tooling (eclipse refactoring/etc).

The only reason to choose GWT is the TOOLING that comes with it.
Just buy a super-fast computer so you that your development will be bearable (superdevmode is awesome with it)
As one google gwt developer said, java was preferable because of the great/mature tooling that already existed around it.

Now there's dart that removes both the pain points of both GWT and javascript apps (angular).
It has been their priority to provide great tool support from the get-go with dart IDE.
If you want angular-style apps, there is dart web-ui.  This is the direction they are going.
They provide you with a smooth edit-refresh cycle, like js development, but with all the tools included for a semi-static language like dart.

So my advice, go for the best of both worlds, dart.
The one disadvantage is the extra learning curve, plus having to context-switch between languages.

That is why certain teams pick a single language for both server-side and client-side.
  - node + any js client framework ( or a full-stack framework like derbyjs) 
  - GWT + any java server framework

If the project is large, I would always choose the one with the great tooling behind it (which thankfully google provides freely)

On Wed, Jul 11, 2012 at 8:14 PM, Chris Oman <ch...@theomans.net> wrote:
Both of these technologies seem to fill the same space, but coming at it from different angles. Has anyone done a comparison between the two and developed a synopsis of when best to use each one?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/bkxA7aEopOcJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.



--
When the cat is away, the mouse is alone.
- David Yu

Wendel de Witte

unread,
Aug 21, 2013, 6:01:22 AM8/21/13
to ang...@googlegroups.com
  • GWT is very easy to develop, understand and to maintain, especially if you introduce new teammembers on a regular basis.
  • GWT has a very good Model View Controller model, using this well makes the application very readable.
  • GWT supports testing tools and debugging of client code.
  • GWT has better performance than any other library.
  • Works very well with Google App Engine.
  • Easy to maintain internationalization techniques.
  • Easy to maintain images and icons.
  • Code can be shared between the client and server. Big pro when the app also have to work in offline modes.
Some comments. Keep your application clean and simple.
  • Don't use UI-Binding.
  • Don't overuse panels.
  • Don't use direct DOM. calls.
  • Don't use the event bus.
  • Don't use code splitting.
  • Only use one single service to communicate with the back-end.
About compiling.
  • During dev only compile against one browser and language. Saves a lot of time.
About Angular JS
  • It is excellent for small projects and try outs.
  • It is fun to use and to learn something new.
but:
  • It feels slow and it gets slower when the project grows.
  • Documentation and tutorials need a lot of work.
  • Custom stuff requires to extends the framework.
  • Like JQuery, it feels like hacking and slashing an App together.
  • It is difficult to read and understand, especially for a newcomer.
  • It has nothing extra which GWT already has, only less.

Maximilian Eberl

unread,
Aug 21, 2013, 6:32:40 AM8/21/13
to ang...@googlegroups.com
Simple but true answer:

if You have many experienced Java developers in Your team who do not really know JavaScript.

Second argument: GWT hides Your code against amateur eyes.

Grant Rettke

unread,
Aug 22, 2013, 1:50:10 AM8/22/13
to ang...@googlegroups.com
GWT is a great, great product, but, the future is HTML5 and JS (6, too).
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+u...@googlegroups.com.
> To post to this group, send email to ang...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Grant Rettke | ACM, AMA, COG, IEEE
gre...@acm.org | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

Andrew Clifford

unread,
Aug 23, 2013, 11:25:33 AM8/23/13
to ang...@googlegroups.com, gre...@acm.org
It comes down to language.  If you are thinking about GWT v. Angular then you are already a Java shop and you haven't invested in JS heavily.  It's a necessary evil and you were told as a young child never to go near JS but you can't remember why.  jQuery is nice but still has that pasta feel to it.  Angular may actually be the technology that provides GWT features but with a lot less code and learning curve.  Yeah, it's weakly-typed Javascript but with test cases and DI (you do write test cases and use DI, don't you), the code should scale nicely.  Angular thinks in modular MVP apps but lacks a tightly coupled widget set.  This is probably good as Angular doesn't try to solve the cross-browser problem widget sets like jQuery UI and Bootstrap are better at.  It's about M and P and data binding V.

I have developed production GWT modules that have been stable and maintainable for years.  The only downside is, given developer turnover, its a long learning curve to train people on the framework and then learn a large but modular code base.  There are always threats to rewrite the UI in something else but nothing better for a server side coder has come along.  Now there is Angular. MVP in GWT requires too much boilerplate.  Angular data-binding solves this.  GWT-RPC works but if I were to do things over, I would have been better served with restful JSON services. Remember to build in code minification upfront too.  

So the question is not Angular v GWT, it's is your perception or knowledge of JS holding you back from productivity-enhancing technologies.

Grant Rettke

unread,
Aug 23, 2013, 12:05:12 PM8/23/13
to ang...@googlegroups.com
On Fri, Aug 23, 2013 at 11:25 PM, Andrew Clifford <bash...@gmail.com> wrote:
> I have developed production GWT modules that have been stable and
> maintainable for years. The only downside is, given developer turnover, its
> a long learning curve to train people on the framework and then learn a
> large but modular code base.

Same experience here. It is kind of bummer that Java used to be the
cutting edge where you learned "how to do it right" and those days are
long gone. You can't even hire people with MVC and basic OO experience
and even graphics toolkit experience. That says nothing about the deep
lack of understanding of synchronicity flow-control, which seriously
screws up GWT apps when you do it wrong. And... the end result is that
GWT systems end up getting really mucked up by the new maintainers.
That is not unique to GWT, but it just is especially ugly! lol. You
really have got to be good at JS/HTML/CSS/Synchronicity, and also
OO/GraphicsToolkits to make the most of GWT.

Ivan Popelyshev

unread,
Sep 6, 2013, 4:24:53 PM9/6/13
to ang...@googlegroups.com
I use both GWT and angular.js in multiplayer game project. GWT compiles game logic (lot of common code between server&client), angular is responsible for ui. I can use different versions of game in one website, just switching the GWT part, and not modifying the angular.

Message has been deleted

Omar Cecilio Palaming

unread,
Jan 8, 2014, 9:59:27 PM1/8/14
to ang...@googlegroups.com
As I am reading the post, if it is a matter of learning curve between GWT and Angular JS.  I really find GWT with Vaadin a perfect match and simple blows the competition away.  Learning curve is fast and I can literally teach people without background in Java to learn the language.  There also lots of example and the documentation is great, not to mention the vibrant community that supports it.

Angular JS, with all objectivity and honesty, I am trying but I think I haven't found the right dynamics to learn or even teach it in the simplest form possible.  And yes javascript is really a mess to maintain.  I just want to say that JS learning curve is much steeper.

Bruce Sauls

unread,
Apr 8, 2014, 1:31:26 PM4/8/14
to ang...@googlegroups.com
Thanks for a truly thoughtful and comprehensive reply.

Jamie Nelson

unread,
May 1, 2014, 11:47:08 AM5/1/14
to ang...@googlegroups.com
Just a quick note to people complaining about java being an ugly, overly-verbose language...
Gwt now supports java 8 (pre-release zip @ https://github.com/WeTheInternet/gwt-sandbox/releases ),
which means that it is actually MORE concise than javascript (lambdas and method handles).

getElement().onclick = function() { /*do stuff*/}
getElement().onclick(()->{/*do stuff*/})

Also, check out this post by a lead on the GWT team about using GWT AND Angular:
https://plus.google.com/+RayCromwell/posts/G1v6j6Pri5u
You don't have to pick angular or GWT, as GWT plays nice with its neighbors.

One last word to the wise: In GWT master, there is a new feature called JsInterop (@JsInterface),
this allows you to write java interfaces over javascript types, and get zero-overhead, zero-boilerplate js interop.
Another bleeding edge feature is the ability to extends html element prototypes and expose them as web components.

This means that instead of using angular js to massage html elements into pseudo-widgets,
you can create your own set of enhanced tags that hide all program logic away from designers. 




This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use, or distribution of the information included in this message is prohibited -- please immediately and permanently delete this message.

Mark Volkmann

unread,
May 1, 2014, 12:05:08 PM5/1/14
to ang...@googlegroups.com
On Thu, May 1, 2014 at 10:47 AM, Jamie Nelson <james....@appian.com> wrote:
Just a quick note to people complaining about java being an ugly, overly-verbose language...
Gwt now supports java 8 (pre-release zip @ https://github.com/WeTheInternet/gwt-sandbox/releases ),
which means that it is actually MORE concise than javascript (lambdas and method handles).

getElement().onclick = function() { /*do stuff*/}
getElement().onclick(()->{/*do stuff*/})

ES6 adds arrow functions so it looks pretty much the same in JavaScript. You can use that syntax now by using Traceur to transpile ES6 code to ES5 so it can run in current browsers. See http://ociweb.com/sett/settApr2014.html. I think it's safe to say that Java will never be more concise than JavaScript.

--
R. Mark Volkmann
Object Computing, Inc.
Reply all
Reply to author
Forward
0 new messages