Monday, February 05, 2007
I knew a guy...
I'm in the process of building a new Web page interface into Etc3beta. The current test interface just asks for a topic and then randomly selects from various input parameters the specific inputs it will use to construct a poem. Nick Montfort over at Grand Text Auto suggests an "Advanced" interface that exposes Etc3's inputs and allows a users to make their own selections.
That sounded like a pretty good idea, so I've been working on that. But Etc this time around is Java and so I did the "For dummies" version using JSP. But I'm an ASP guy, so that was a bit of a struggle. The advanced version isn't served well from a single form. It requires a set of inputs for each stanza a poem is to have. So I needed to save each set and then pass that over to the JSP page that will do the actually writing. So I decided to use JavaScript. Just save off the data into an array and then when the time to climax is nigh, shove it all into a cookie and retrieve it along with any relevant POST data in the composition page.
But I'm not a JavaScript guy either. I've written a couple of Hello World scripts, but nothing for production (or of any complexity). It's close to working, but boy-oh-boy, is it ever ugly--a brute force amalgam of html (and I'm far from an html expert as well), JavaScript, and JSP scriptlets. Ugly code is almost always an indication that the coder doesn't really know what he is doing. And that really shows here.
Debugging is really frustrating. I use NetBeans but NetBeans doesn't do syntax checking for either JavaScript or JSP scriptlets. You discover those during execution. But if a JavaScript function has a syntax error, the browser simply doesn't call it. It doesn't blow up the way I'd want it to. (At least in Firefox, the only testing I've done.) JSP requires a JSP server (I use Tomcat) and fortunately Tomcat does catch and report on syntax errors, but in an error page. And to make things ever more difficult, Tomcat wants Java 1.4 and I've used 1.5 for the Etc3 core. (Fortunately, all of the core is in a separate Jar which can be evoked with 1.5.) The problem is that my fingers want to use 1.5 features in the JSP pages, which aren't reported as 1.4 errors until the page runs.
Now, I know for absolute certain that somewhere there are better development tools for this kind of programming, that Tomcat can be configured to use 1.5, that the procedural code I'm writing to build xfer data could be better done with objects. But golly, I'm struggling with getting information out of a multiple-select html form list control. I'm not going to "waste" time learning the right way to do any of the really hard stuff.
Reminds me of a guy I once worked with. Really, really smart. I've seem him debug programs in languages he didn't know. And he could get anything to work. But he refused to be acquainted with anything like a design principle or to become fluent in any computer language. His philosophy (not unshared in the world of application development) was to learn just enough to make something work, build it as fast as you can, and deliver it to the customer. And (at first) customers loved him. But the code was pretty much impossible to understand, fraught with bugs, and extremely difficult to enhance. His code looked like my Etc3beta code. And caused his customers and his organization a lot of heartache.
Quite a bit of electronic writing is like this. Really smart folks leveraging computational technology for art, but in the absence of sound development practices. Sooner or later, as a community of artists, we're going to have to address this. Otherwise, the work will eventually languish in the vast swamp of mediocre programming, like Etc3beta's Web presence.
But until we do, I guess we'll just keep saying drive on....