开发者

Advantages to using GWT over PHP

I'm looking at creating a site for a start-up and I'm trying to decide if I want to build i开发者_如何学Got 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.


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)


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.


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)

Advantages to using GWT over PHP

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜