Sunday, July 30, 2006

Matt Raible made me do it

I'm a software developer. I've been developing web applications of varying degrees of complexity for about six years or so, mostly in Java. I investigate a lot of new technology in the Java space, and I've been noticing for a while now that whenever I google for information about some bit of technology, I always find something on Matt Raible's blog. I've never met the guy and, as far as I know, don't use any of his code, but I feel like I know him pretty well at this point. Which got me thinking: maybe there's something to this blog thing. So here is mine.

I've been writing software for pretty much as long as I can remember. I can remember a time when I wasn't very good at it, which always seems to have ended about five years ago. But I can only barely remember a time at which I wasn't involved with computers in some fashion.

My folks bought a computer, an Atari 800, when I was about 11, but even before that, I had taken some programming classes. I wanted to get a Commodore PET, because that's what I'd used in the classes, but my parents bought the Atari instead. That was probably a better choice. I mostly worked with BASIC and some 6502 assembly on it. I ran a dial-up bulletin board system using software that I'd written myself. I upgraded to an Atari 520ST in the late 80s, but it was a pain to develop software for that machine, and I didn't do much work on it. Soon after I graduated (sort of) from high school, in 1990, I got a job writing software in C under MS-DOS. I bought a PC (a 33MHz 80386) because I figured that I should have one if I was going to make a living from it. I worked on the Mac for a few months and even on the Philips CD-I, then moved on to OS/2 for a while. In 1995 I found a job writing in C++ under AIX and have been on the Unix side ever since. In 1999 I started working mostly in Java, and that's where I am today. But I am troubled.

In 2001, when I was on vacation for a couple of weeks, I built a web site that allowed users to upload and critique photos. I called it photoSIG. I wrote it in PHP because it seemed like an easy development path and because I could get cheap shared hosting. I was able to write the app in no time with PHP. I didn't worry about mixing the view with the business logic or anything like that because it was five years ago and, as I mentioned before, I didn't know about those issues then. The site became amazingly popular, and before I knew it, I was on a dedicated server, and then I was on two dedicated servers. photoSIG went from zero to a million pages per day in about eight months. At that point, PHP started showing its limitations. I used a lot of caching in order to deliver the performance that I needed, but that led to a lot of data-freshness issues. I also had scripts that ran from cron to do things that were too expensive to do in the context of a request, for example, to increment view counts in the database, but sometimes those would fail. It was becoming a mess.

So in 2002, I set about rewriting the system in Java. This would fix my performance problems, I thought. I could use more intelligent caching, write threads (rather than cron jobs) to take care of housekeeping issues, and so on. I did rewrite the system, but after deploying it, I started thinking that I'd only swapped one set of problems for another. The Java system, for one thing, was not noticably faster than the PHP system. It was much larger and took much longer to write. The code had better structure and was more reusable, but the reusability, at least, was an academic concern because I had nothing to reuse it with.

At least I didn't use EJB. I'd already had experience with EJB when I started the photoSIG rewrite, having led the development of a big commodity derivatives risk management system that used EJB pretty extensively for a couple of years prior. That system wasn't completely done in by EJB, since I recognized when I started it that entity beans were lame, but even stateless session beans were a big bother. For the new photoSIG system, I developed regular POJO service classes and managed transactions myself.

In 2004 I started converting parts of the system to Spring and Hibernate. I like both of those technologies, Hibernate in particular. But here's the thing: I don't feel that they're making my life any easier. They offer ways to solve problems, but the solutions themselves are pretty complex. I find that I'm spending an awful lot of time trying to work out the best way to apply these technologies to each situation and editing configuration files rather than working on the actual business problem at hand. It's no fun spending a lot of time dealing with infrastructure issues when you'd rather be writing an application. I'll get into some specifics in a later entry.

So I'm troubled. And I'm starting to think that something is wrong here. It doesn't seem like things should be this complicated. Maybe all this dependency-injection and object-relational mapping stuff is overrated. Or maybe Java just isn't up to the task at hand?


Post a Comment

<< Home