tags:

views:

138

answers:

3

Hey all,

I'm looking at creating a site for a start-up and I'm trying to decide if I want to build it with GWT. I've done alot of PHP before and would like to continue that but a colleague of mine suggested using GWT instead. I read the information that Google has published about it and I see that all of the scripting is Python. I've never used Python before but it doesn't seem that challenging.

Anyway, question is, to all of you that have used GWT, what do you think of it as opposed to sticking with a PHP approach? Is there anything you can do with GWT that you can't with PHP and vis versa.

Thanks!

EDIT: Sorry, confused the Python in GAE with GWT.

+6  A: 

GWT and PHP are not mutually exclusive.

GWT, or Google Web Toolkit, started as a Framework that will let you write Java code which produces an AJAX Application interface. You write Java, HTML/CSS/Javascript comes out. The UI layer of GWT has nothing to do with the backend server. GWT produces a UI that calls AJAX URLs. There's no reason those URLs couldn't be implemented in PHP. GWT doesn't care what technology is on the other end of a URL, so long as it returns data in the correct format. You can read more in the Communicating with a Server section.

GWT is a decent approach if the you're happy with the general look/feel/behavior of the widgets it produces, and if you know Java.

If you need/want fine grained control over the HTML output of your application (common for a lot of PHP developers), GWT is going to introduce more headaches than it solves (unless you like spending a lot of time in Java land)

Alan Storm
@Alan - GWT is very much about the server side, as it produces both server and frontend code, bundled together.
adamk
@adamk GWT *can* produce server-side code, but is by no means *required* to. You can take the JavaScript generated by GWT compilation and use it with any server (or even run locally, or as a Chrome extension without a server at all)
Jason Hall
@Alan Why do you say that one should only use GWT if they don't care about the look and feel of the application? GWT is just as easily stylable as any JavaScript framework, because that's all it is. Would you say that JQuery produces ugly applications?
Jason Hall
That's what I get for talking about things I haven't looked at in years :) I wasn't aware of GWT RCP (http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideRemoteProcedureCalls). Although, most of what I wrote still stands, as it looks like the toolkit still provides support for agnostic HTTP requests (http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideHttpRequests)
Alan Storm
@Jason It's not a matter of ugly, it's a matter of control. My take on UI frameworks like GWT is you accept the overall design of the widget (and I'm including functionality in design) and you can apply styles to it, and often get "pretty" results. Changing overall look/feel/behavior of a widget in GWT requires writing new Java to change the behavior of the widget. I wouldn't say the same thing about jQuery, but I **would** say the same thing about jQuery UI.
Alan Storm
@Alan I see. So it's not a problem of GWT producing ugly apps, but of the pre-existing widgets bundled with GWT being "set in stone" and potentially requiring the developer to write their own widgets for maximum flexibility. Is there any UI framework where this is not the case? It seems like offering that much flexibility out of the box is just giving people more rope to hang themselves.
Jason Hall
@Jason That's an accurate description of the trade offs and yes, that'd the case with any UI framework, but the average PHP developer is going to have an easier time hacking on a PHP or Javascript UI framework than they would a Java one.
Alan Storm
+1  A: 

GWT and PHP are (usually) mutually exclusive.

GWT is a framework by Google which allows writing rich web applications, usually single-page apps (such as GMail, Google Wave etc.) - what is usually called RIA (Rich Internet Applications).

The framework allows defining the front-end layout and the back-end processing in one Java project. When built, it produces HTML+JS which is cross-browser compatible, and a back-end runnable in the form of a Java Servlet.

Besides the possibility to easily share definitions and code between the front and back ends, a substantial benefit is the built in RPC mechanism which allows to simply call a back-end method directly from the front-end code, without worrying about the AJAX calls at all.

It's true that the web design process is completely different with GWT - you hardly see HTML or JavaScript when designing the web interface, and it's more similar to traditional UI design. Luckily, we have some fairly good UI libraries - such as SmartGWT (which is a wrapper around the SmartClient RIA JS library).

Note that there's no Python programming at all with GwT (maybe you were referring to Google AppEngine? that's a completely different thing)

alt text

adamk
@adamk I think I would say that GWT is more powerful/useful when used in concert with a Java backend (e.g., code sharing, GWT-RPC), but I would definitely *not* say that the two are so closely related that you can't run a GWT frontend with a PHP backend.
Jason Hall
+4  A: 

This is a subjective and argumentative question and thus should be closed - you don't provide any info about your startup so it's hard to provide a concrete answer, so you'll only hear subjective opinions from either sides of the camp :)

That being said, let's get some things straightened out :) GWT and PHP can work together (and do nicely too - I've used PHP in my previous GWT project). You use GWT for your frontend, while PHP for the (server) backend. Communication is usually done via JSON. GWT provides a very nifty thing called JavaScript Overlay Types that allow for a very smooth (and fast, since it uses browser for the parsing) integration in your GWT app of the JSONs you get from the server. Also, if you're an (experienced or not :)) PHP programmer, UiBinder should be a breeze to learn and it offers a familiar environment to create templates for your widgets.

With the advent of GWT 2.1 however, it might more advantageous to stick with "pure" GWT, for client and server. This is mostly because GWT 2.1 does a lot of work for the programmer when it comes to communication between server-client (caching, auto-updates Comet style, etc). See this presentation from Google IO 2010 for more info.

Oh, and PHP and GWT as a whole aim for different things: PHP is for sites with dynamic content (so most "normal" sites nowadays), while GWT is best for creating RIA (Rich Internet Applications - think GMail and the like). While you can create RIA with PHP, it's cumbersome - the same goes for GWT and "normal" sites (you'd rather just create small widgets in GWT to embed into a normal, maybe PHP generated, site).

PS: One think that is definitely (IMHO, of course) that GWT has advantage over PHP is language. It's a matter of preference, but I prefer strongly typed, object-oriented language like Java, over PHP, that's trying to be many things at once (adding object-oriented functionalities, some info about types, etc.) - the one thing I didn't like about my GWT+PHP experience was the PHP language - maybe it was just my lack of experience in PHP, but I just didn't like the type of code PHP made me write.

Igor Klimer
Subjective or not, it seems like there's a lot of useful information in this thread/question.
Alan Storm
I know, that's why I provided an answer nevertheless :) But if the OP would specify what sort of startup he wants to create, we could maybe answer the question of what are the advantages of GWT over PHP for *this specific* case - general discussion on such topic won't get us anywhere (though is interesting) and is discouraged on SO, from what I've seen. I don't mind sharing knowledge, just don't want to litter around in the process :)
Igor Klimer