Saturday, September 11th, 2010

Program the web like a desktop

This post is from my old blog. The exact publishing date has been preserved for archival reasons.

In recent years, Google gave birth to the Google Web Toolkit or GWT for short. It is a Java source to JavaScript compiler. It takes a Java developer's code, and turns it into a JavaScript-based web application. All units that are not native to JavaScript are compiled to JavaScript.

Using such technology allows programmers who are enjoy programming desktop interfaces but dislike HTML/JavaScript to make web applications like they would a desktop application. Knowledge of CSS is good, but the examples in GWT come with a good array of CSS files to use in your own projects.

For Java Programmers this is good, as they could code the Frontend in Java, and even code the backend in Java Servlets. For those out there who do not like Java, and do not wish to learn it, there is another toolkit. This other toolkit is based off of GWT and shares all the same APIs, you can basically refer to GWT API documentation to use this other toolkit. This toolkit is Python based and currently goes under the name Pyjamas.

I prefer using Pyjamas over GWT, as Python is my main language. Comparing a similar application in GWT and in Pyjamas, I can see that Pyjamas is less code to develop an application. Also the Python code is much easier to read than the Java equivalent. Away with the brackets and in with the indented lines! I remember having so much bracket hell in other languages that use brackets for their begin/end of blocks. Mind you I still have DIV tag hell, and that's where Pyjamas comes in.

To use Pyjamas the programmer does not need any experience in HTML, however some is good to make use of the HTML API call, if needed. Heck, the programmer does not even need experience in JavaScript, although to make it easier to debug, it would be good. But since Pyjamas comes with a handy '-d' parameter, one can easily make a JavaScript application output an stack trace similar to how Python does, telling the developer where the issue is in the Python code. Simply wonderful!

All in all, I would recommend Pyjamas to any Python developer wanting to develop their desktop applications for the web. If said developer separates their code in an MVC manner, porting is as simple as altering the view and placing what needs to be server-side, server-side. Likewise, I would recommend GWT to Java programmers as well.

Looking back...

I still use Pyjamas, but only for specific tasks. Making all websites feel like a desktop application doesn't quite right.

About Me

My Photo
Names Kevin, hugely into UNIX technologies, not just Linux. I've dabbled with the demons, played with the Sun, and now with the Penguins.

Kevin Veroneau Consulting Services
Do you require the services of a Django contractor? Do you need both a website and hosting services? Perhaps I can help.

This Month

If you like what you read, please consider donating to help with hosting costs, and to fund future books to review.

Python Powered | © 2012-2019 Kevin Veroneau