[Jython/Java] Which books, which IDEs, which other tools?

Jonathan Hogg jonathan at onegoodidea.com
Thu Jan 24 11:00:29 EST 2002


I worked on a Java project recently, but used Jython extensively for testing
and experimenting with the code as I went along - something that Jython is
very well suited to.

Given that it wasn't a Jython project as such, here are my answers:


On 24/1/2002 7:21, in article a2ocnj$qci$1 at rex.ip-plus.net, "F. GEIGER"
<fgeiger at datec.at> wrote:

> 1) Which IDEs are out there for Jython?  Which one do you use?

I didn't use an IDE for Jython itself. See next answer.

> 2) Which IDEs are out there for Java? Which one do you use?

I did much of my development on Mac OS X using the free Project Builder IDE
that comes with OS X.

Since you need the help of a good IDE more for Java than Jython, use any
decent Java IDE. I just added the Jython.jar file to the Java project and
set the Jython interpreter main class as the "run" class for the project.
Then when I ran the project it would pop up a Jython prompt and I could
dynamically instantiate objects, plug them together, and play with them.

> 3) Is there an IDE necessary being able to handle *both* languages? Which
> one at best? Or do I always need two IDEs?

I spent 99% of my time debugging the Java and 1% debugging my Jython ;-)

Running Jython within your Java IDE enables you to run it in debug mode and
set breakpoints in the Java, which I found much more use than being able to
set breakpoints in the Jython code.

> 4) Which books do you recommend on Java? I'd like to read about everything,
> not just some core stuff. For Jython I've already ordered Bill's book. Are
> books in a style "Java for <whatever> programmers" advisable?

I made do with the O'Reilly Nutshell set. I think if you're an experienced
programmer, they cover pretty much everything you need. Once you've grasped
the syntax (which isn't all that hard) the majority of the grind is in
learning the standard libraries, for which I found the Nutshells excellent
references.

> 5) Which additional tools should I use / do you use to program in
> Jython/Java?

Nothing in particular.

> 6) Any additional pointers? Things I've not asked but I should know about?

Some recommendations I have (others may be able to add more):

 * Use the JavaBean conventions for your classes (getters and setters,
   AWT event model, etc.) as Jython understands this and will make things a
   lot easier for you if you do. For example, with methods called 'getFoo'
   and 'setFoo' in a class 'MyClass', you can write at the prompt:

       >>> x = MyClass()
       >>> x.foo = 5     # calls x.setFoo(5)
       >>> print x.foo   # calls x.getFoo()

   This saves a heap of typing. You can also do neat stuff with the AWT
   events. See the Jython documentation for more details on this.

 * Implement 'toString' for every class you write. Believe me, you'll be
   glad you did. Jython uses this for 'str' so you can do:

       >>> x = MyClass()
       >>> print x

   and get something sensible. That is, if you wrote a sensible toString.
   The project I was working on involved parsing a custom language, so I
   implemented appropriate toStrings to write out the concrete
   representation of any parse node. We didn't need it anywhere in the
   project as such, but it made debugging the parser a huge amount simpler.

 * Implement all of the small highly cohesive parts as Java classes, leave
   all the messy glue logic to Jython code.

Once Jython 2.2 comes along with all the iterator/generator goodies, Jython
is going to rock.

[Side note: after you've used them together for a while you come to realise
how painfully clumsy Java is in comparison.]

Jonathan




More information about the Python-list mailing list