简体   繁体   中英

Migrating an existing web application to google web toolkit

I have a django-based web application that is a mixture of jQuery and several other JavaScript libraries. It has been suggested that consolidating everything under Google Web Toolkit would make moving things forward a little easier. So I have a few questions regarding this:

  • Could we keep our HTML/CSS or would we have to rewrite?
  • Would GWT integrate easily with JavaScript libraries that we already use? (datejs, jQuery.scrollTo, etc)
  • Would you recommend rewriting everything due to GWT's different workflow?

First, a caveat: there are different degrees to which you can "consolidate everything under Google Web Toolkit." You could just write a client-side JavaScript library in GWT, or write the entire client-side implementation in GWT, or write the client and the server in Java using GWT. I'll try to answer each of your questions for each of the use cases.

Could we keep our HTML/CSS or would we have to rewrite?

If you're just writing a client-side library in GWT, you could keep the HTML/CSS mostly intact. If you're writing the entire front-end or if you're writing the client and the server in GWT, you could probably port most of the HTML and CSS, but you would have to make a lot of little changes.

Would GWT integrate easily with JavaScript libraries that we already use? (datejs, jQuery.scrollTo, etc)

For the most part, yes.

If you're just writing a client-side library, then absolutely yes (because the GWT code would be just another library). If you're writing the entire front-end or the client and server in GWT, life will be harder because you'll probably have to write JSNI wrappers, which will take a little work but not be terrible.

Would you recommend rewriting everything due to GWT's different workflow?

No, I wouldn't. This isn't so much because of opinions on GWT versus JavaScript, but more because a total rewrite is usually a bad idea. A bunch of refactoring over time is a good idea, but throwing away code wholesale is usually a bad idea, because that code has been tested. If you throw away a bunch of code rather than refactoring over time, you lose bugfixes that you have made over time, and you make the same mistakes, test for them, find them, and fix them all over again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM