Five Minutes on the Soap Box
[This entry was also written sometime last week...]
I rambled through my last entry, so this time I'll try to stay on topic. And what's the topic, you ask? Good question, I'm not quite sure, but I'll figure it out soon. Hmmmm. Did you see the Giants game last night? Yep, pretty exciting. Yep. Hmmmm. Nice weather, eh? Sure is.
Ahh yes, I've been thinking a lot lately about the state of application programming and the magic of well-designed, reusable components. The Java world has come a long way in the past few years in this respect. Just take a look projects like Jakarta Commons and Hibernate, to name just a couple. The open source community is finally starting to build on top of itself, and we're starting to see some real innovation as a result.
I remember when everybody and their brother would implement their own Base64 codecs, and now so many of these mundane tasks are handled by the Commons project. I remember when JDBC was considered a high-level library for accessing databases, and now we have these great really-high-level frameworks like Hibernate and JDO. I remember my first experience spending hours with DOM APIs to pluck objects out of an XML document, and now I could use JAXB in about 20 minutes to achieve the same effect. Sure, many of these libraries aren't part of the core JDK, but over time we've come to trust and use them as we do for say, the core Collections classes.
Over the past few months I've been hacking away at the Mu project while also helping out Paul Noffke with his novel tRio project. We were sharing ideas on how best to implement pluggable audio sequencer and content hierarchy frameworks, and it became apparent that we could be sharing libraries, not just ideas. Going further, I was thinking that we could share the same content interfaces and data structures with Reed Esau's cool JReceiver project. It wasn't necessarily obvious (see the recent Ken Arnold interview) when each of us was designing our applications that we could be breaking these modules off into their own reusable libraries, but one could quickly see the benefits of such a collaboration. In fact, one of the next things I'd like to tackle is to break out some of these modules into libraries that we or anyone else out there could use in their media-based applications.
We as developers need to think less about writing monolithic applications. It should be more like putting a jigsaw puzzle together, where the pieces are things like reusable libraries and remote web services. Invariably, when you're putting a puzzle together, there are one or two pieces missing. Resist the urge to just shove the piece of gum you've been chewing for the past four hours into the hole. Sure it might fill the gap, but it probably looks quite poor in comparison to the rest of the puzzle. Also, it's no fun scraping old gum off a table. Yuck. Spend the extra effort, even if it doubles your development cycle, writing a small library. Chances are, someone else out there (perhaps even you a few months later) will find the library useful and will really appreciate the savings in their development cycle.
On a related note, I'd like to see a report on the amount of time people spend wrangling with native GUI, I/O, and networking interfaces when writing applications for a specific platform. Apple has spent many person-years developing iTunes in Objective-C and Cocoa (I'm guessing), and meanwhile Microsoft has spent similar number of person-years developing their Media Player using whatever, C++ and MFC I assume. In the end, both apps serve essentially the same purpose, but are only useful to the folks that own each respective operating system... I just performed a cursory experiment on freshmeat.net and found three dozen or so implementations of the game of chess. Written in Lisp, written in Perl, written in Java, written in C, this one uses GTK+, another uses Qt, and the list goes on. I guess the point I'm getting at is: how much time have we as an industry wasted over the years reinventing the wheel, writing redundant libraries and applications for every quirky platform under the sun (no pun intended)?
Let's instead focus our efforts on new applications that make people's lives better or easier in some way. Take something like Hydra, which Daniel Steinberg mentioned in a recent entry. This is an amazing piece of software that really changes the way you think about collaborative editing. And yet, only 4% of the computing world's population can leverage this innovation because it was designed specifically for Mac OS X. Don't get me wrong, I love my PowerBook, and this app's Aquafied interface is beautiful and usable. But we need to think about developing for people, not for your favorite UI toolkit or the programming language flavor of the week. [I'll spare you the Java evangelism, as I'm sure you could see where this point was heading...]
I believe it was Bill Joy (or someone similar in the League of Outspoken Smart People) who said something like "I'd rather have well-debugged binaries than open source code, any day". I like to think both concepts go skipping through the prairies hand in hand. Reusable binaries make constructing varied, complex applications a relatively simple process. Open source collaboration allows those binaries to be developed taking into account the feedback from other possible consumers of your technology. It shouldn't be an either-or scenario.
The things I've discussed here shouldn't be news to anyone, these are the fundamentals they teach you in Software Engineering 101. But sometimes it helps to remind ourselves that innovation is always within reach. Spend the extra cycles to design solid building blocks. If your structure should be dismantled someday, at least you or someone else could reuse the construction materials (okay, okay, I suck at analogies). Anyway, here's a simple test: if you find yourself writing an application and you're thinking about naming it "Yet Another So And So", you've failed, go innovate elsewhere. Otherwise, the community awaits your creation; why not host your project here on java.net for everyone to see?
[And what does any of this have to do with Java 2D, you might ask? Not a whole lot; I do have an interest in open source development, and it's just some stuff that's been weighing on my mind for a long time. But man, this was a rather bookish (i.e. not very fun) entry on my part. Maybe next time I'll give an update on what's happening these days in Java 2D Land.]
In my ears: "The Grand Hour", Guided By Voices
In my eyes: "Breakfast of Champions", Kurt Vonnegut