Request for advice - python, wxpython, Jython, java
Alex Martelli
aleaxit at yahoo.com
Sat Sep 8 17:17:14 EDT 2001
Kenneth Tsang wrote (I've cut two of the comp.lang.java subgroups: I think
no msg should be posted to as many as *five* groups in all!):
> Hi, I am currently working on an applications that has the following
> criteria, please advice what's the most effective use of the above
> technology, Python is on the list because of the amazing capability, and
> 'battery included' features (i think this is the best description)
>
> a)multiple language support
> b)cross-platform support
> c)ease of deployment - as it has to be used in different countries
> d)short development time
Looks like a good choice to me.
> Could someone advice the best architecture of using Python, 'cos it seems
> to be one of the best choice here.
>
> a)wxPython has used for building some windows GUI, which is really
> impressive as lots can be done within a day, windows GUI is chosen because
> the application may involve lots of analysis (involve drag and drop..)
It's hard to fault your choice. Tkinter is more popular, PyQt has some
enthusiastic fans, but wxWindows/wxPython is truly excellent.
> b)should part of the code be in Java, for future expansion (esp. on
> integration with other systems), and for scalability!?
If I were you, I would go either all-JVM, or no-JVM -- mixing JVM bytecode
and native code is trouble you can do without. If you choose JVM, forget
wxWindows -- you'll have to use Swing (or AWT, but Swing's nicer).
Integration with other systems cuts both ways -- it depends on what you
have to integrate with (as long as you mean, on the same box; across the
net, solutions such as SOAP, XML-RPC, and others, make it rather
indifferent whether each system is pure-Java or no-Java). Do notice that
one of your criteria is "cross platform, ease of deployment". With JVM,
you get that _except_ on Windows XP -- XP will not have a JVM, so your
deployees would have to download and install it separately -- very easy if
they're tech-savvy, not so easy otherwise. With no-JVM, i.e. CPython, you
need to prepare stand-alone executables -- so far that's easy for Windows
and Linux (with py2exe or Installer), doable under most unix-like
architectures (with freeze), but I'm not sure where you'd even start if you
needed that for, e.g., OS/2. So it depends on HOW MUCH of cross-platform
ease you need -- *widespread* platforms, or also very rare ones?
> c)if b) is chosen, how about the choice between Jython and CPython? I have
> to go with Jython!? But will this imply that I can't use wxPython!?
Right. There's a Tkinter port for Jython, I hear, but clearly not 100%
pure Java, so there would start your trouble.
Of course, you could and should separate the part of your code that is
strictly about GUI's (maybe 10% to 20%, depending on what your programs do)
and the "engine" that is the rest and should be coded independently from
the GUI -- so switching GUI's should be anything but traumatic.
Depending on your schedules (and your desire to get involved and help the
project move faster), you might like to look at anygui.sf.net -- code to
that, and your code should move between (e.g.) Jython+SWING and
CPython+wxPython (and others) with no effort. Of course, anygui will never
support the full richness of your chosen toolkit's possibilities, but if
you can do 80% of your GUI with anygui and only access the backend toolkit
for the remaning 20%, the effort of supporting several GUI toolkit backends
becomes really minimal.
> d)If I chose a thin client (browser based) approach, what is the
> configuration required? Pls advice, as I haven't gone into this
> area...(And will it has deployment issue!? need lots of IT support)
Needs _least_ IT support -- each client only needs any good browser -- but
may need lots of good bandwidth, depending on the application. The server
side could use Apache and, e.g., mod_python -- or Zope.
> The concern is that though Python is powerful? should we code everything
> in Python? (even you have to choose between CPython and Jython)
Python is the most productive way to code, in my opinion, particularly with
the "Extreme Programming" methodology. However, when you come to
tuning the system for performance you may find that some bottleneck needs
recoding in C to achieve maximum speed (similarly you could recode in Java
if starting with Jython, but the performance gain is nowhere as large) --
unless your performance bottlenecks all come in areas for which Python can
already offer good speedy extensions, such as numeric computation, image
processing, unlimited-precision arithmetic, databases, networking, 3D
modeling, PDF formatting, and so on, but that covers only about 90-95% of
applications -- yours might be somewhere in the other 5-10%!
Similarly you could add native-coded extensions to JVM code with the JNI,
but if you lose the 100%-pure-Java quality I think you lose much of JVM's
potential advantages. I hear that coming JVM's are rivaling native-coded
abilities in terms of speed -- but I've been hearing that for six years,
and it's not really true as yet, alas. Still, if you're willing to bet on
this, then there's little to choose between a pure-JVM and non-JVM approach
in this case -- CPython and Jython are basically the same apart from speed
(CPython tends to be 6-8 months ahead in terms of development), Jython lets
you use the huge amount of Java libraries and CPython has lots of its own
extensions and ease to wrap any existing C library, etc, etc.
Alex
More information about the Python-list
mailing list