What is wrong with GWT.
ryandoherty.net
ryandoherty.net
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.
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.
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.
... 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.
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).
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.
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.
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.
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!
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.
For projects that get completed, I could believe two or three... Maybe more in cases that are trivial to do with rails.
The nightmare I've seen happen with Ruby projects is that the "developers" are often web designers who know how to do things that are easy (or trivial) to do with rails, but get in over their heads rapidly.
Python, on the other hand, has a culture of doing the 20% of the work that gets you 80% of the way to production, announcing that they're done, moving on to a greenfield project, and then laughing at the "Blub" programmers in PHP and Java who work so much harder to get things production-ready.
Java's greatest strength, on the other hand, is it's greatest weakness. Java has a huge number of libraries that make it possible to do wonderful things, like Lucene and Hadoop. There's "more than one way to do it", which means that real-life systems might have 5 different JSON libraries used in different parts of the system. A programmer who needs to work on a small part of an application might need to wait for Maven to download 650 megabytes worth of JAR files. When you have 650 megabytes of dependencies to deal with to work on 65 kilobytes of code, it takes a very small amount of bullshit per kilobyte in the dependencies for you to spend more hours messing around with the build system than you spend developing.
> Ruby (...) "developers" are often web designers who know how to do things that are easy (or trivial) to do with rails
> Python (...) has a culture of doing the 20% of the work that gets you 80% of the way to production, announcing that they're done, moving on to a greenfield project
I have met, during my career, a lot of incompetent professionals like the ones you describe above. Most of the time, they work with "safe" technologies, the ones they are sure there will be demand for. Java, PHP, C#, ABAP and VB are their favorite tools. When you see someone proposing something crazy, like using Python (or Ruby, or Smalltalk, or Lisp, or Erlang) on a very enterprisey application, they are either lunatics or just very, very smart. BTW, to be fair, I've seen lots of very competent Java, PHP, C# and even VB programmers. But they are exceptions, not the norm.
And no. I have developed tons of Python code from concept to production. If we have this 80/20 culture, I have, so far, managed to be completely oblivious to it. The main difference between your anecdote and Java projects I have seen in the past is that nobody but management claims they are done.
So...was GWT developed for Java web developers that didn't want to learn Javascript? Javascript is just one of the things you have to know how to use to build a modern web site or web application.
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.
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.
Or if you do, you will have to concede that it is wrong to write anything but assembler code.
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.
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?
Whether you choose to write your code in Java or Javascript doesn't matter because it will HAVE to be run in a Javasript environment (browser) so you will always be limited to the target language - Java allows you to connect to databases with JDBC, read/write files and create rich user interfaces - none of these language features can be used by javascript in a browser.
So solving a problem that is more appropriate for Java can never be a problem that needs to be solved inside a browser by javascript...
Enclose the quoted phrase in asterixes...
Java doesn't let you connect to databases or any of that - the JVM does, and for any language running on it (Scala, Clojure, etc).
Java the language just gives you a certain set of syntax and semantics which can be useful to model a problem and its solution - classes, interfaces, etc.
Even if you're limited by the API of the platform - the browser - that has nothing to do with whether a different language is useful or not for your particular problem.