5 ms·
What is wrong with GWT.
- VikingCoder 15y agoWhat is wrong with blog posts Lately I've been reading a lot of blog posts assailing a technology as though proponents of that technology think all other tools are useless in all situations. Replace "GWT" and "JS" in this article with "C++" and "Assembly," and all of the points still hold. But C++ is still incredibly useful for many developers, and so is GWT. GWT largely exists because it has a reason to exist. One of its main reasons to exist is that browsers are not standards compliant, and sometimes the standards are ill-defined. A well-defined abstraction layer on top of that is very useful... right up until it's not. Sometimes you need to dig in to Assembly, and sometimes you need to dig in to JS. But quite often, higher-level abstractions get you all the way from start to finish.
- vetinari 15y agoActually, my first thought when reading this blog post was "oh no, it's C vs. hand-tunes assembly again." We know, how that ended up.
- rbanffy 15y agoYou know... It's in fact much more like the reverse: compiling assembly language into C. Java is a less expressive language than JavaScript. The result is that you code in the slow-to-develop/fast-to-run language and it spits out fast-to-develop/slow-to-run code.
- oelewapperke 15y agoAnother way of saying the same thing would be GWT: develop in a language where managing complexity is doable and well-understood, and run in a write-only language that can be run everywhere Java has lots of advantages, like coherence and interoperability between libraries that javascript lacks (never mind the actual existence of more than 5 libraries). Also GWT allows you to write run-anywhere code. These days it's pretty much a safe bet that all your code will work perfectly well on all browsers, not just the desktop ones. If you develop for mobile and don't have 500 phones, this is a blessing.
- ses 15y agoThis is an old article, and a poorly written one at that. Strikingly though one of the criticisms that seemed most poignant to me is: "GWT completely ignores the fact you are creating a website, NOT an application"... I think this shows a serious lack of forethought on the author's part to not see that many websites were turning into web applications, and many enterprise applications with desktop clients had also started to go down this route.
- darklajid 15y agoYou should have read the link at the top as well, providing a follow-up that mostly contains "Ok, I didn't know thaat much about GWT when I wrote the first post, so here's my largely revised and far less polarizing opinion".
- drivebyacct2 15y agoAnd this is why my blog only has 4 posts over 2.5 years. I simply don't have the desire to take on such polar opinions with such little topic background. It seems these knee-jerkish opinion bits on Dart, GWT, X, Y, Z have grown in popularity here. I enjoy the discussion because the comments here are full of more information than I could quickly aggregate myself, but I wonder when I will become a pompous enough software engineer to feel the need to write posts like this.
- alexkearns 15y agoThis is just another example of the "there is only one way to do things, my way" philosophy that taints so many discussions about software development. Sure, GWT does not create the cleanest mark-up and javascript in the world but maybe that is not always your goal. You may just want to get a web app up and running quickly but are lacking the javascript expertise - cue GWT, which allows you to harness your java expertise to create a web app. If you don't like to create web apps this way (I for one would much prefer to hand code javascript), then don't but also don't go around name-calling the technology "disgraceful" just because it does not serve your own specific purposes.
- MostAwesomeDude 15y agoWhy does one need JavaScript to build a web application?
- tcarnell 15y agoEVERYTHING is wrong with GWT - just dont use it. Generally I believe the idea of writing code in one language to be converted into another is wrong. Languages are tools to do a job - pick the right one for the job or it will end in tears.
- markokocic 15y agoWell, believe it or not, some people will choose safety net of Java the language over JavaScript, especially for web application. It takes a lot of discipline to work on large JS code bases, and writing Java instead of JS could be a good choice for some projects if developer skill set is leaning towards Java. Also, it seems that there is a fraction in Google which likes Java, hates JavaScript and has enough resources to go with projects that bring Java to browser like GWT or Darts. Personally, if they already like Java so hard, why they don't "just" create nice JRE/browser/DOM integration package so we could use any JVM language instead of JavaScript.
- tomjen3 15y agoYou don't really believe that. Or if you do, you will have to concede that it is wrong to write anything but assembler code.
- tcarnell 15y agoJavascript is interpreted. Which actually highlights my point that languages (of any level) have usually been designed to solve a particular set of problems or targetted for a particular type of runtime environment. Thus, the likelihood is that converting Java into Javascript or Pl/SQL into LISP or ActionScript into Python will provide no benefit but will almost certainly complicate the development process.
- icebraining 15y agoJavascript is interpreted. No, it's JIT compiled, at least in any recent browser or in Node.JS. Which actually highlights my point that languages (of any level) have usually be designed to solve a particular set of problems or targetted for a particular type of runtime environment. But what if you have a problem that fits Java much better than JS, but you just need to distribute the client through the browser?
- rbanffy 15y agoIndependently of the merits of GWT or the follow-up apology post, Java is an awful language to write web applications with. Languages like Ruby and Python (mostly when associated with frameworks like Rails or Django) allow you to become much more productive, yield a much smaller codebase and much lower long-term maintenance costs. As for the JavaScript side, if you find it daunting, you may try Coffeescript or even Closure (which provides some Java-developer-friendly limits to JavaScript). Java has its strengths, but writing web applications isn't among them.
- PaulHoule 15y agoI've got complex feelings about Java. The comparison with Ruby and Python isn't really fair. A better comparison is C#, which is like Java in spirit but has a large number of incremental improvements over Java. Underlying it all, Java has an attitude that concision doesn't matter. One reason why people don't do anything interesting with generics because you always have to write GenericContainer<AnotherGenericContainer<ArbitaryTypeA>,AbitraryTypeB> = new GenericContainer<AnotherGenericContainer<ArbitaryTypeA>,AbitraryTypeB>(); C# has var, extension methods, function pointers, generics without type erasure and many other little things that show respect for the programmer. You realize then that the "problem with Java" isn't an all or nothing thing (static types suck), but an obstinate cultural attitude that's gone on for 15 years. C# might not be as concise as some languages, but it shows you can have something a lot like Java that isn't as bad... and that makes it clear how outrageous Java is!
- rbanffy 15y ago> The comparison with Ruby and Python isn't really fair. It's fair because there is nothing stopping you from picking up any of them, a decent framework and be orders of magnitude more productive than either a Java or a C# developer. C# is a better language than Java, but it still comes short when it comes to developing web applications. There are hugely successful apps written in C# and Java, I agree, but their existence is owed more to the brilliance of their developers than a brilliant choice of tools.
- 15y ago
- PaulHoule 15y ago"Any time you program one language in another, you lose all the benefits of the target language" ... yeah, like when C gets compiled to machine code, you lose all the benefits of machine code. On some level that's true. You can certainly write machine code that's faster than C, and often you can take advantage of hardware features that the C compiler can't use (in some cases, SIMD.) On the other hand, C code can be portable across platforms and developers can be more productive. GWT keeps one important attribute of Javascript: the ability to run cross-platform on web-browsers. It trades the benefits of programming in Javascript for the benefits of programming in Java. Static types have some advantages, and you get to work with Eclipse and have automated refactoring and a good debugger. His fundamental criticism against single-page webapps is valid, but this is true about Java applets, Flash, Silverlight as well as some Javascript frameworks. A fundamental criticism I'd have of GWT is that it's very to build very complex applications in GWT, complex enough that the problem of managing asynchronous communication becomes a real bear.
- rbanffy 15y ago> ... yeah, like when C gets compiled to machine code, you lose all the benefits of machine code You know that's an apples to oranges comparison. JavaScript and C are much more expressive than assembly language. This complain is that you are writing code in a less expressive language (Java) that's being compiled into a subset of a more expressive one (JavaScript).
- PaulHoule 15y agoAssembly, C, Javascript and Java are equally "expressive" in the sense that they're Turing complete. Anything that can be "expressed" in Javascript can be "expressed" in Assembly. Most of the features people like in Javascript can be faked in some manner in Java. Anonymous objects can be used to insert anonymous functions into Java code... At great cost in verbosity. Variables never really escape Java "closures" but the resulting immutability leads to a functional programming style that has real benefits. Javascript's real advantage is a clearer syntax that's easier to learn and easier to read. If statically typed languages value concision, we can get the benefits of static types with little cost.
- jfoutz 15y agoOur customers were thrilled to see their 20 year old applications running on an iPad. I don't know how that would be possible without a java interpreter for funky old languages, and GWT as a bridge to the web.
- ttcbj 15y agoIn my view, GWT is for creating large/robust web-based applications, and that is where machine-level optimizations really pay off. If you are writing a tiny utility on a page, hand coded javascript might pay off, but if you are writing a large/complex application, it becomes impractical for a human to do what a optimizer can. I am not saying that GWT is perfect for everything, but it pains me to think of writing (and debugging, and refactoring) a large application in javascript, or any weakly typed language. I've tried it, and found it difficult to maintain.
- rbanffy 15y agoIs there a good definition of "robust" in this context?
- oelewapperke 15y agoMore than thousand lines ? Javascript becomes a disaster to read or maintain. Tools like Jquery help, but not enough to make it usable. Javascript is like perl. And, frankly, Java is not. You can actually manage a huge Java application (and you can even have the work done by barely-competent programmers, which is a plus). There is no way to have 50 programmers working on a 50000 line javascript app.
- joshhart 15y agoCheck out scalagwt. They've enhanced GWT to read a protobuf abstract syntax tree so that any language could be compiled to javascript if it can target that output. The first language they have working is Scala, which is far more suited to working with frontend code than java and in my opinion better than javascript. The nice thing about GWT in general is that you get to use a traditional oop approach to maying out the components of a webpage ala java swing. http://www.google.com/m/url?client=ms-android-verizon&devlocsession=off&ei=_VSUTuDEMoXaqAPNhwE&gl=us&hl=en&q=http://scalagwt.github.com/&source=android-browser-type&ved=0CBcQFjAA&usg=AFQjCNE5sNJ8eaGDqMVqJniEiKBlgzKOHA http://www.google.com/m/url?client=ms-android-verizon&de...
- rdoherty 15y agoOh hi, OP here. I wrote this a long time ago. My opinion has changed a little in that time. I've already heard the arguments for/against GWT and understand its benefits. Not really sure why it's on HN now and honestly a little embarrassed by it.
- jtmille3 15y agoJust to beat a dead horse, most languages, especially scripting languages compile down to something else. I don't use GWT, but I could understand the lure of using a known language that has established great tools to create a powerful web applications. From what I understand it will even optimize then obfuscate the javascript for you. As for the degradation argument, that is a weak negative.