Python, Java, C++: One step forward, two steps back

Friday 18 February 2005 at 19:12

This rant is a cleverly disguised thank-you note to bivio. I'm lucky to work for a company that prefers dynamic languages.

For one of our customers, I'm wrapping a C++ library with python. As a recovering java geek working in python is a step forward. But much of the work is actually in C++. Two steps back.

I've used many, many different languages starting with Apple BASIC and wandering through pascal, HyperTalk, Excel & Word macros, AppleScript, AutoLISP, DOS batch files (shudder), Turing, MacPerl, Tango, bash, TCL, Python, PHP, perl, Java, and JavaScript roughly in that order. (We'll just overlook the xml-ish languages like JSTL, Ant, and Jelly.)

Very few of those languages require an explicit compile step: Pascal, Turing, Java. Java was my first introduction to a build environment. Every other language I've used has been interpreted and dynamic. C++ introduces a whole new level of pain in the build step.

compile and build considered harmful

This is now my favorite sales pitch against compiled languages: the build process is a huge timesink which brings marginal value to the resulting software.

Working in C++ means working with make just as working in Java means working with ant. But people don't write their own Makefiles, they run a configure script. They don't write that either. That gem of a shell script is generated by a collection of things called autotools. autotools includes aclocal, autoheader, autommake, autoconf. autoconf is a shell script, the rest are perl scripts and the whole mess depends on a pile of m4 macros. All these C++ programs are depending on sh, and perl, and m4 for their assembly.

THAT'S WAY TOO MANY MOVING PARTS!! TOO MANY LAYERS OF CODE GENERATION!!

Here's a simple news-flash. Any sufficiently ambitious program in any language needs another program to build it. USE A DAMN PROGRAMMING LANGUAGE FOR YOUR BUILD! I suggest perl or python both of which are probably already installed on your computer.

Of course if you write your build in perl or python, you may get hooked. You might even decide to just write your program in perl or python and spare yourself the build problems altogether.

Aw, who am I kidding? What most of us are really writing is resumeware anyway and these days resumeware isn't written in perl nor python. (Oops. I probably wasn't supposed to tell. ;-)

*eric, the Java programmer, slips into a dream...

So now instead of this to build your Java project:

% ant -f my-build.xml build

You type this:

jython my-build.py build

Hmm... I wonder what maven would look like re-written in jython...