Developer

Book review: Essentially Jython misses mark for language novices

Jython is the hot new language, combining Python's rapid development capabilities with Java's tremendous resources. This book review of O'Reilly's "Jython Essentials" looks at the most recent attempt to flatten the learning curve.


Jython is the latest kid on the block, offering Java programmers the benefits of rapid application development in the Python scripting language. Jython is a 100 percent Pure Java implementation of Python that runs under the Java Virtual Machine (JVM). This ingenious hybrid allows programmers to use both Java and Python libraries to quickly deliver solutions in both Java and Jython environments.

O’Reilly’s latest offering on the subject, Jython Essentials, claims to target developers with some Java knowledge and no Python experience. But in reality novices to either environment will need to do quite a bit of background reading to get much use from the book. Once you have a working knowledge of both environments, however, Jython Essentials can serve as a guide for speeding up your Java code production.

Jython Essentials
By Samuele Pedroni and Noel Rappin
O'Reilly & Associates
Date published: March 2002
250 pages
ISBN: 0596002475
List price: $64.00



Not really an introduction
According to the book’s forward, I represent the target demographic; I have a working knowledge of Java but am by no means a guru, and I am aware of Python’s constructs, but have not used it to write code.

My background was not enough. True, the first five chapters of Jython Essentials are an overview of the Python/Jython scripting language, but the overview was difficult to get through until I completed an online Python tutorial. For one thing, the material is organized in a somewhat unconventional manner—granular details are often covered before general concepts, such as variable scope and inheritance.

In most cases, there’s no explanation of where or if mentioned concepts will be explained. A lot of space is wasted talking around these concepts instead of presenting a simple sentence that defines them. Several of the overview’s examples compare Java code to Jython code. This approach is helpful in getting a general idea of what’s going on, but Python concepts are very different from Java and the examples really need explanations of the Python handling.

Chapters six through 12 are obviously the book’s intended focus. These sections cover various aspects of using Java in Jython, and vice versa. I felt more comfortable the Java-comparison style examples here because they are directly applicable, not merely devices to explain basic syntax. Ultimately, this hands-on section is what gives the book its real value.

In short, if you are an active Java developer looking for rapid solutions to some of the tedium and lengthy keystrokes you’re used to, this book is intended for you.

Nit-picks
Coming into the book as a Python novice, I felt like I was reading a convoluted Anne Rice novel. Portions were difficult to get through, while the rest was straightforward and clear.

One thing that threw me for a loop is the author’s creative definition of Python. In the preface, they state that “the use of the name ‘Python’ refers to information common to both Jython and the original implementation of Python. Using the name ‘Jython’ is a signal that the concept is applicable only to Jython.” So, although chapter titles make claims like, “Chapter 2, Jython Basics,” the content talks only about Python. This is true for about half the book, and it left me wondering if I missed something. Of course, if you’re a member of the viable target audience of Java programmers, and not the cross-section of developers the authors failed to address, this probably won’t bother you at all.

Tips included in the book make it clear that development of the Jython language is heavily dependent on advancements in CPython, Jython’s counterpart for C programmers—although this issue is never directly addressed. Explanations of CPython advancements help describe where future versions of Jython are going, but I’m not sure that I actually cared about the CPython notes. It’s a little weird that all the tips are about CPython, and none of them are about Jython itself, particularly considering the disregard for straight Python programmers that I mentioned above. Breaking from the O’Reilly tradition, there are no tips at all in the advanced chapters.

To be honest, I am a big O’Reilly fan, but I don’t normally read the books cover to cover. I usually chapters I find interesting and then use the books for reference. The Jython Essentials book might serve that purpose well, except that apparent First Edition formatting issues muddle the content somewhat. Some sections outline functions and methods in a clear, easy-to-reference style while others describe them in a strictly textual format. Formatting seems to get more consistent later in the book, but useful information wasn’t highlighted very well.

Highlights
Even though Jython Essentials breaks from expectations laid out in the beginning, I like the very targeted approach of the material. For Java programmers, the information is relevant and concise. The Java-related content is broken out very well, and examples cover common tasks. The differences between the various combinations of Java and Jython are made clear, and usage is explained well.

Another good thing about the content is its timeliness. The authors account for the release of Jython 2.1, which probably released while the book was still being edited. Often books about scripting languages are obsolete by the time they hit the shelves, but the author’s heavy involvement in Jython’s development helped narrow that gap.

I did quite a bit of outside research while making it through this book. A lot of the material is available online, but Jython Essentials definitely expands upon existing documentation. The chapter about integrating with Swing is especially distinctive, and alone makes the book worth the shelf space.

How to get the most out of this book
Overall, this is a good book for transitioning from Java to Jython, but you’ll need some supplemental information. For Java programmers, I recommend learning a bit about Python before committing to Jython Essentials, either through tutorials or O’Reilly’s book, Learning Python. Come back to this book and read Appendix D: Jython and CPython Differences, followed by chapters one through five. Only then will you get the most benefit from the advanced chapters about integrating with Java.

If, on the other hand, you’re a Python programmer without a lot of Java experience, you should definitely learn Java concepts and structures before reading Jython Essentials.

In all, I felt the main focus of this book was for a very particular skill set. If you are a Java developer with some Python familiarity, Jython Essentials can help you. Otherwise, you’ll need to gain some background before taking the leap into this book.

Editor's Picks

Free Newsletters, In your Inbox