11

Since I'm learning Java in this period and I just finished with the tutorials I think I'm ready to start contributing to a project (since I know from experience this is the best way to really learn).

I've seen GWT, looks interesting so I thought I should give it a try. I'm thinking however, since GWT deploys Java applications in JavaScript why should I learn GWT when I could learn the actual thing instead (this being JavaScript). My question: is it worth it? Wouldn't someone be better of learning JavaScript if they want to build JS applications, instead of using Java and GWT? I realize that it might be easier to build certain things with GWT but in the end is it worth it?

Thanks.

Peter Boughton
  • 4,562
  • 1
  • 30
  • 27

5 Answers5

6

GWT is essentially a compiler to native code, much like Visual Studio compiles source to byte codes or machine language.

This allows the programmer to abstract the differences in underlying architecture away, much like Visual Studio users not needing to worry about the differences in word length, the number of registers and exact conventions for calling the operating system when they code for 32-bit or 64-bit.

This is a good thing, as it allows you to move some of the maintainance burden over to others. As this is Google you know they have more development resources than you have, so you are essentially bringing in extra manpower for free.

  • 2
    Another benefit is hosted mode debugging. So you can debug the logic of your Application, through both the client and server side and with all the tools of the step through debugger. – Jeremy Nov 14 '10 at 15:18
5

I dislike it

Everything you can do with it you can do cleaner without it.

Josh K
  • 23,019
  • 10
  • 65
  • 100
  • Agree. But, you are writing pages with multiple images with one file per image. Right ? –  Nov 14 '10 at 14:34
  • 1
    @Rocket: I don't understand what *"multiple images, one file per image"* means. – Josh K Nov 14 '10 at 15:15
  • It is image tag in HTML and src attribute. Server will send a file to client if there is such attribute to let browser render it on the page. If you have different image with different file then you have 2 image tags with 2 files. thats what I mean. –  Nov 14 '10 at 15:37
  • 4
    @Rocket: I fail to see what images have to do with GWT. If you want to enable sprites you can, otherwise yes you have multiple images. – Josh K Nov 14 '10 at 16:11
  • 1
    @Josh My guess is, your adding small animations etc rather than writing a large complex. Theres a reason why scripting langauges are limited to small tasks and statically typed languages are used for larger tasks. – mP01 Jun 19 '11 at 10:19
  • 2
    In a word tooling. No one has written a real comparable editor for javascript compared to the many available for java. – mP01 Jun 19 '11 at 10:20
  • @mP01: It's foolish to compare Java and JavaScript. The similarities end with both names containing "Java." Why should the editors be comparable? To refute scripting vs static would take more space then a comment. Maybe make a question about it? – Josh K Jun 19 '11 at 17:31
  • What a lousy answer. Yes, it addresses the question "what are you[sic] thoughts on GWT?", however your rhetorical "I dislike it" adds nothing to the debate, and nothing in your answer indicates you are at all familiar with GWT. Can you give some examples of the "everything" that can be done cleaner, and explanations of why? – funkybro Sep 17 '13 at 07:13
2

A few reasons that is good to catch up with GWT:

  • Every technology has a life cycle. GWT is at its up swing. Learning GWT will give you the technology advantage over a longer period of future time.
  • GWT using java, brings structure to web application. JavaScript is more suited for scripting. Backed by java, GWT is more suitable for large applications. If you have noticed the frameworks/toolkits on top of JavaScript, you may conclude like I do that JavaScript by itself is not enough for serious projects. All those frameworks bring structures to the application development. GWT is one of those frameworks, and is the one that will prevail.
  • Mobile application is a revolution in the software world. The revolution is at its early stage right now. More and more software will move to mobile platforms. GWT is now the most comprehensive cross-platform application development tool you can find.

Given that said, GWT is actually not tightly related to the web service frameworks from google or from sun (servlet). The integrated tools focus more on integration with their servers, due to google's or sun's business nature. To leverage the technology power of GWT, one should more or less ignore some of the server integration hyper. Just use GWT as an client application tool, it should be more beneficial to your future career.

minghua
  • 130
  • 4
2

The very reason GWT took Java as source language is because JS (Ecmascript) is inhumanely difficult to work with. GWT is just a nice way to bring programming to Web/browsers where it was not possible before.

Before GWT there were futile attempts to program something in browsers (Ajax, dojo, plain javascript). But forces of nature are too violent there, so everything falls apart (browsers change, they are never same, people speak different languages, people think that 15 images should be actually 15 files etc).

So answer is: If I were to code for internet ocean boiler (which is not my job), then I'd choose GWT.

P.S. Another thought. The JS is made by Netscape. The company is long dead but the language stays there unfinished and rotting

  • 6
    -1 ECMAScript is constantly developed; ECMAScript 5 just came out last year, and ActionScript, the language of Flash, *is* ECMAScript. –  Nov 14 '10 at 09:50
  • 16
    -1. JavaScript is **not** *"inhumanely difficult"* to program in. It you find JavaScript difficult you are very likely not very smart. Before GWT there were people who knew what they were doing. After GWT there are people who can't code JavaScript (and use GWT) and those that can (and don't use GWT). On top of it, JavaScript has exploded past the browser, look at Node.js and MongoDB. Use SpiderMonkey or V8 to write platform independent scripts. – Josh K Nov 14 '10 at 13:36
  • 3
    @Josh K. I also consider Visual Basic 6 even more difficult to program than JS. Java is easier about 50 times than Basic. And CSharp is easier may be 2 times than Java. By difficulty I mean doing practical complex applications which are maintainable, created in teams, sold to customers. I dont care about differences in syntactic sugar. And I think that if you need to be very smart to use language, then something wrong with the language. –  Nov 14 '10 at 14:14
  • 3
    JavaScript is very easy to design large maintainable applications built by teams. I've done it. There is nothing hard about writing modular code except people decide not to. – Josh K Nov 14 '10 at 15:17
  • Don't confuse DOM with JavaScript. It's not JS that is the problem. – Andrew T Finnell Aug 26 '12 at 11:48
1

It depends on what you want to do (as for most tools anyway).

If you want to go into the details of web development, use many (sometimes different) tricks of the browser environment, and the newest features of them, have the guts to fight with small tricks that makes your web app 'look cool', GWT will always be in your way: if you have the time and experience, you can do all and more with your hands. And yes, there are many other toolkits that will help you along the way programming in JavaScript.

However, if you want to make a "not-so-fancy", but stable GUI for your application that "should", and in most cases really do the same, and look the same in various browsers without tricks, GWT is a good choice, the best I know about. Explanation: Google is definitely motivated to keep it in sync with the most browsers and the newest technologies, and definitely has enough resources to do it. Yes, you adhere to another giant instead of doing your own stuff. Question: what is your job? To provide the same service to the widest rage of users through a web interface with the smallest effort - or make a shiny, exceptional web portal which has the coolest features on the newest platforms.

+1 reason: I think it is beneficial to keep your application in one codebase, and one language. You could do neat trick in database scripts - but you lock yourself to that db server. You can do external stuff with shell scripts or batch files - but you lock yourself to the operating system. You can implement some of the controller logic in JavaScript to provide a rich client interface in a browser - but you may lock yourself in one browser. For all cases, it is not easy to keep them in sync with the core application data structure and requirements (and perhaps the hardest one is the constantly changing browser+JS tools environment). I am convinced that if the core application is in Java, all stuff should be in Java - with a very small fraction of cases when you really have to put a part of the logic into another environment.

I picked GWT because of my answers to the above questions - and it does what I wanted it to do: in about 2 weeks after installation I had an acceptable web interface for an internal server monitoring system - although I had experience with Swing. (No, I have not used the default look and feel and yes, I used CSS and classes for presenting logical information :-) )

Check your current and planned tasks - and choose the right tool for them.

Lorand Kedves
  • 648
  • 4
  • 8