Will Python Be Good For This Type Of Project?

Steve Holden steve at holdenweb.com
Thu Sep 29 08:51:40 EDT 2005


Hal Vaughan wrote:
> I'm self taught and most of what I've been working on for the past several
> years has been entirely in Perl and Java.  I've noticed that I can code
> about 5 times faster in Perl than Java, in part because I feel like
> whenever I want to do something in Java, I have to create an object, do a
> few preperatory things, then do what I need, but in Perl, I just call the
> routine.
> 
> Java, however, does much better at cross platform apps, especially if I need
> a GUI (I find Swing easy to use).   I need to write a setting editor which
> basically consists of a GUI with a lot of checkboxes, radio buttons, and
> option select lists.  I originally had something to do this in Javascript,
> but Javascript was not strong enough to let me create data structures to
> keep track of the data.  I had to store it in 3d arrays, which was hard to
> keep up with.
> 
If you find Swing interfaces easy to build ans use then Jython should be 
a natural: you can do all the GUI stuff in Java and control it from 
Jython, thereby neatly avoiding yet another potential "What's the best 
GUI toolkit" [answer: same place as the world's best hamburger].

> I was planning on writing the new setting editor in Java for several
> reasons, including the ability to create my own objects to store groups of
> settings.  I also can write it so it'll run on a computer by itself, or as
> an applet with very little extra work.  That's a benefit, since it means it
> can be run from anywhere through a Java enabled browser and a username and
> password.  It can also be run on a system where it's been installed without
> using a browser (either way, it reads and writes the settings from a URL).
> 
Java does have the advantage when it comes to dynamic clients right now, 
given that the Python virtual machine can't be assumed to be available 
in the browser environment.

> Someone on a mailing list I'm on has suggested that I look into Python, and
> use Jython to compile it.  I see that I can write applications and applets
> in Python (but I haven't seen references to being able to write one
> application just once and have it work as both).  I also know Python is a
> higher level than Java (a few people I know say it's almost like writing
> pseudo code).
> 
I have been known to provoke people by calling Java "object-oriented 
COBOL", but if you're happy with Java you might find Python a bit terse, 
and be a bit nervous about it's apparently happy-go-lucky attitude to 
namespace protection.

If you like to be able to easily mix procedural and object-oriented 
approaches then I think you might want to give Python a try.

> At this time I don't know Python (I've looked at some sample code and I'm
> still getting used to loops and if statements without closing braces!). 
> What I'm trying to determine is 1) if it's relatively easy to write a
> program to work as an application AND an applet (depending on how it's
> called), 2) If it'll handle the networking to read what amounts to web
> pages full of setting info and write that back in POST statements without
> problems from the user's point of view and easily from the programmer's
> point of view, 3) What coding time and difficulty is like in Python
> compared to, most specifically, Java and Perl, 4) Is it easy for me to
> interface Java and Python classes seamlessly, and 5) (I realize only I can
> answer this for sure, but opinions and experience of others would be a
> help!) Is Python easy enough and fast enough to code in that it'd be worth
> me taking time to learn it and doing the project Python instead of Java?
> 
1) You'll need advice about "applet" from someone more versed in Jython 
than I.

2) Definitely no problems in the networking department

3) Not as terse as Perl, somewhat faster than Java would be my opinion, 
but I'm only one data point. I found the verbiage of common Java idioms 
irritating, there's nothing like that with Python.

4) Yes.

5) You should learn a new language now and then just to stay in practice 
and get in touch with newer ideas. Python isn't that hard for a Java 
programmer to learn, though naturally there are differences. The two 
languages in combination should give everyone what they want (though of 
course there are always some people who just want to complain about he 
way things are).

> Any help, thoughts, comments, and such are appreciated!
> 
> Thank you!
> 
> Hal 

Some of each to get you going. I hope this has helped.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                          www.pycon.org




More information about the Python-list mailing list