[Baypiggies] The skinny on Pyjamas
glen at glenjarvis.com
Fri Aug 13 18:58:28 CEST 2010
As posted by James, here's the quick skinny on pyjamas if you never heard of it.
As a pyjamas user, I thought I'd chime in. I have been using pyjamas for about a year and a half. It is a breath of fresh air for developing web front ends. My front ends tend to be very application-like, with lots of data-driven widgets. The widget set in pyjamas is very basic, but it is very easy to create new widgets that do exactly what the application needs. This is IMHO where pyjamas particularly shines; if you need a UI widget that is not provided, you just create it. In python.
Additionally, if you need some code that works identically on the front end and the back end, it is just a matter of importing it (in python) on both sides. For example, I wanted rc4 encryption for an app (don't ask!). It was a quick hack from the Wikipedia pseudocode to make a module in python. Then, I imported that module into my pyjamas code, and I imported exactly the same module into my back-end code. It worked flawlessly.
I would be remiss if I did not mention that PureMVC also works in pyjamas. While there is some effort needed to get through the jargon, the event system and component code separation you get with PureMVC are worth the effort if you are doing anything complex.
The minimum back end for a data-driven app in pyjamas only needs to serve static files (your compiled pyjamas app), together with a JSON-RPC listener, which can be in any language, and can be installed in most frameworks. A JSON-RPC call in pyjamas (once set up) looks a lot like a function call. You have to use an async methodology, but that has its blessings as well.
Pyjamas compiles separate code for each of the major web browsers; it started as a python port of GWT in (fluffy) java. The GWT documentation still applies in most cases, though in practice I tend to keep a gedit window open with several pyjamas UI modules for reference. The source for any widget tends to be small and readable.
Widget styling uses CSS, which alleviates one major headache in UI design. You can addStyleName or removeStylename for any widget anytime you want, and the web browser just obeys.
I have only touched on the major things I love about pyjamas. There is more. The main advice is: don't be afraid to try pyjamas; you'll be happy you did. Use the version in the svn/git repository; it is the most up-to-date (small crowd: not very frequent releases). You already know python. Dive into the source at pyjamas/library/pyjamas/ui for the widgets. Play with and build the examples at pyjamas/examples. It's more mature than you think.
Posted by James Washington
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies