pyjamas in action?

lkcl luke.leighton at googlemail.com
Wed Sep 16 14:29:05 CEST 2009


On Aug 31, 8:35 pm, André <andre.robe... at gmail.com> wrote:
> On Aug 31, 4:46 pm, kj <no.em... at please.post> wrote:
>
> > At work we want to implement a webapp using Google's GWT, and we're
> > debating whether to use the standard GWT approach with Java, or to
> > tryPyjamas.  There's no great love here for Java, but there's the
> > concern thatPyjamaswill not be able to deliver the full power
> > and/or convenience of standard Java-based GWT.  (Why-oh-why did
> > Google pick Java for this?  Couldn't Guido twist some arms?  Just
> > kidding.)
>
> > Are there any examples of real production websites implemented with
> >Pyjamas?
>
> > TIA!
>
> > kynn
>
> Perhaps you might get answers faster if you posted to thepyjamas
> group:http://groups.google.com/group/pyjamas-dev

 that's a fact :)

 yes, there are.  http://www.worldfairtradeday09.org - see the FT100
section and any of the events e.g. http://www.worldfairtradeday09.org/events/tomtoms
will take you to a good one, which has had photos uploaded to it and
links to youtube videos.  of course, you can't see the admin interface
and you shouldn't create a dummy event just to do so because it's a
live site.

 regarding the "convenience", you kind-of answered your own question
by then saying "why o why" :)

 the story behind http://lovelysystems.com who are one of the major
pyjamas contributors is that there was a decision made from "on high"
to forcibly choose GWT over pyjamas, despite the entire company being
a python shop.

 so, after the engineers chose pyjamas, and the management chose GWT,
the engineers strugged for several months using the unfamiliar and
bloated eclipse environment, 99% of which they didn't actually need,
and 99% of which didn't fit with their existing infrastructure,
working practices and the back-end zope-based services.

 what blew GWT out of the water, finally, to their great relief, was
in attempts to utilise and create JSONRPC services.  the issue is
this: java is a strongly-typed compiled language, whereas python and
javascript are dynamically-typed interpreted languages.

 when JSONRPC services return a complex result, comprising lists of
dictionaries of objects containing lists, dictionaries and objects,
the GWT infrastructure *FORCES* that return result through its strict
type-checking.... even though the ultimate target language is in
fact... a dynamically-typed language!

 so, basically, GWT, being java, puts a stranglehold over you.

 as a python developer, this will drive you nuts.

 but if you are a java developer, who has been used to this kind of
crap, you will be absolutely fine - because you don't know any other
simpler way.

 but: you really do need to look at the differences between the GWT
infrastructure and the Pyjamas infrastructure.  take a look for
example at GWT's i18n and l10n internationalisation support: it's
_tens_ of thousands of lines of code, and _hundreds_ of files,
supporting over one hundred individual languages, each with number
formats, date formats and so on.  pyjamas internationalisation
support: a pattern, comprising about .... 50 lines of code.

 our focus, as a community effort rather than a google-corporate-full-
time-multi-man-team-funded effort, is therefore on the tools and the
infrastructure that _we the contributors_ need and enjoy working on,
which is a much smaller subset of functionality than "that which
'employees of google' are tasked with".

 so, like lovelysystems, who have some amazing python and javascript
engineers, you should utilise pyjamas if a) you feel that the use of
GWT's infrastructure and libraries is not going to be worth tolerating
the pain barrier of java b) you are prepared to dive in to the (very
compact and readable) pyjamas libraries if the code doesn't do what
you need, and to contribute.

on top of that, there is one last unasked but important question: how
can i "trust" the compiler?  there's a simple answer:
http://pyjs.org/examples/libtest/output/LibTest.html - the regression
tests.

these regression tests actually run under the standard python prompt,
so you add a test, run it in standard python, then compile it and test
it in the browser.

we are also working to get the regression tests to run under
spidermonkey (the mozilla js command-tool), python-spidermonkey (the
python bindings to the spidermonkey library) and pyv8 (the python
bindings by flier liu - http://code.google.com/p/pyv8 - to the google
v8 library).

once _that_ is done, then there is the plan to start running the
STANDARD http://python.org regression tests, all 25,000+ of them,
through the pyjamas compiler.

yes, this is possible.  basically, pyjamas becomes a python
accelerator, by translating to javascript and using the JIT google v8
engine to execute the resultant code.  flier's work has linked the
python and the javascript namespaces, and the author of the python-
spidermonkey library has also done likewise, but flier's work is more
comprehensive: he's even linked exceptions between the two languages
as well, so that exceptions thrown in one language can be caught in
the other.

l.



More information about the Python-list mailing list