tags:

views:

157

answers:

4

For web application development, I've been steeped in dynamic languages such as Ruby, PHP, and Python. Using popular frameworks for these languages, all my knowledge about HTML, CSS, and JavaScript transfers fairly straightforwardly: templates are basically HTML with embedded code that the server executes to generate the dynamic sections of the page.

Lately, I've been thinking about using GWT for building the UI of my next project. At this point, I'm just trying to wrap my head around how development with GWT works, as seems to follow an entirely different paradigm. In addition, it seems there's an unstated assumption that the server-side part of the app is written in Java. Would it be impractical to use something other than Java for the server side?

Related question:

http://stackoverflow.com/questions/1904893/gwt-gae-python-frameworks-for-comet-rpc

+1  A: 

I don't think there's any requirement that you use Java on the server. At the end of the day, GWT compiles Java to JavaScript. You can do all the comms via the RequestBuilder object, you don't have to use the RPC services.

I guess the question is: if you don't like/know/prefer Java on the server side, why would you use it on the client when it's effectively an abstraction over JavaScript anyway?

Ash
I'm really not familiar with GWT. At this point, I'm still trying to get a high level understanding of how you use it, and what it enables you to do more easily. In particular, I don't know what RequestBuilder is, nor am I familiar with RPC services. Can you please clarify?
allyourcode
Your question assumes I have something against using Java. That's not the only possible reason for wanting to use something else on the server-side. Also, "it's Java" isn't one of the selling points of GAE. An example of that would be that it has a good browser history management system, which isn't part of standard JavaScript. On the other hand, if GWT pushes you to to use Java for the server-side, that's an entirely different question, which is exactly what I'm asking.
allyourcode
Sorry, I assumed you had already started investigating it. The documentation at code.google.com/webtoolkit is probably a good place to start. In particular for RPC, see http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html.
Ash
Oh, and RequestBuilder allows you to manually build HTTP request objects to send to the server.
Ash
@allyourcode: "Your question assumes I have something against using Java". No, the question is why you would use Java on the client when it's not "native" Java, but an abstraction for JavaScript, and then not use it on the server when it's "really" Java. GWT doesn't enforce or require you use Java on the server at all, I'm merely querying why one would want to do that. I'm sure people could think up situations or reasons where it makes sense, but it doesn't seem like a common use case to me.
Ash
+1  A: 

There is no requirement to use Java on the server side. GWT supports JSON out of the box. Any server side component that can generate JSON ( or other supported serialization methods ) will work. You could use PHP on the server side, or bash shell scripts, it doesn't matter to the Javascript code that is generated by GWT.

fuzzy lollipop
+1: true but I must say that the integration of GWT+GAE through Java is appealing... I'd rather have it Python all the way but hey, I'll use what's free :-)
jldupont
I want to reemphasize my question is about the *practicality* of such a setup; I really don't care if this is possible if it requires me to jump through all sorts of hoops to get it working. "GWT supports JSON out of the box" tells me something, but JSON support is a feature of JavaScript itself, which is no surprise, since JSON was designed to work specifically with JavaScript.
allyourcode
The question is answered, I think, but asking how *practical* is to implement a stateless JSON RPC server in your language. If it's easy to map URL's to code, and ease to write code that generates the needed response (XML, JSON, or whatever GWT likes...)... great! And you can benefit from a very good (and forced) delimitation of UI and Logic (side efect: you cannot borrow data-objects between these two layers...).
helios
+1  A: 

While not actually impractical I would say that you get the most value from GWT by having the same code on client and server, since it allows for easy code reuse (fx. if your data objects are serializable then you could just send them directly to the client). So I guess my answer would be; yes you can do it and it's going to be more work than just having Java on the server side.

Lars Tackmann
Thanks, Lars. So far, yours is the only answer that addresses whether this is practical (ie whether there are significantly more hoops to jump through); whereas, the other answers talk more about whether such a thing is even possible.
allyourcode
+1  A: 

Yes, it can be practical. I use Rails as my backend and GWT/GXT as my frontend. I love every bit of it! I couldn't stand worrying about browser incompatibilities, so GWT/GXT was a real joy. Also, I had already started my backend in Rails and did not have much experience with Java on the server, so I stuck with Rails.

You may want to take a look at an appropriate GWT Rest framework, as you won't be using RPC.

As an aside, there is one exception where you should use Java on the server. That's if you want to use Google App Engine.

Feel free to ask me any specific questions and I'll be happy to help you out.

Good Luck.

-JP

JP