Using scripts to hide complexity and only making it worse

I recently had to work with software that is customizable using Jython script. As much as I like both Java and Python, this environment was a nightmare.

The problem was the inability to write Python in the Python script. First off was the old version of Python. The script was limited to version 2.1 (8 years old as of this writing), while the rest of the world was on 2.6 and 3.1. Furthermore, almost every single standard Python library was missing. Only a few core modules such as sys were available.

Both the input and output for the script were Java objects. A lot of thought had to be dedicated to the particulars of how objects were translated between the two languages. Since most of the standard Python API was missing, a lot of the script was written using the Java API.

The end result was a script that was essentially Java code in Python syntax. Programmers would need to know both languages to be able to maintain the script. The environment could have been improved dramatically by doing one of two things:

  • Adopt Java wholeheartedly. Don’t use Python to manipulate Java objects.
  • Adopt Python wholeheartedly. Use a recent version. Make the standard API available. Use native Python objects for the input and output.

Post a Comment

Your email is never shared. Required fields are marked *