This web app is a simple ledger accounting thing for all of the various local groups in the state to use to track taxing for our client. It's basically an online version of quickbooks for these groups. They can enter in a few different types of data. All told, it's actually rather small, the database is only about 20MB total.
First, it's written in Java. This isn't horrible, Java on the server is nowhere near as bad as Java on the desktop (at least the toolchain is mature). Whoever originally wrote this application must have been tripping on LSD. It's a bunch of JSP files that all include each other in one way or another. It's a lot like some hackish PHP (is there any other kind?) that I've seen.
Second, it's written for Java 1.3. We run it succesfully on Java 1.4, but I first have to rewrite a sizable portion of the data access code.
So far, none of this is really that bad. Well, what I mean is, it seemed really bad when I first started on the project, but recent events really take the cake.
About four weeks ago, we got to a point where we had to move to the client site to continue working, so that we had access to their infrastructure and development databases. When we get there, the one machine they have for the three of us to work on (luckily we rotate days) is literally falling apart. I hit the power button and the face plate fell off. The red and blue phosphours in the monitor are starting to die, so everything has a greenish tint. Oh, there's also some banding on the display as well. The space bar on the keyboard only works half of the time. I just reallized today that there is not a padded cushion on the side of the mouse, that's a thick layer of grime.
It's running Windows 2000 that probably hasn't been reimaged in 6 years. Internet Explorer can't open new windows, meaning we can't use Exchange Webmail to access or work email. The Windows Find utility won't open, it just sits there looking at you like you're some kind of retard. The security policies won't let me open the run prompt, but I can navigate to CMD and run that. We can't get certain plugins to install for Eclipse, because for some unknown reason the installer thinks we're running an incompatible version of Eclipse (yes,I've verified we have the right version, as well as verified on another machine that the plugins install properly).
My first task is to get the app running on this workstation. Tomcat is already installed, my boss did that the day before. He spent a few hours n vain trying to get it to run, though. I get there and find out that he doesn't have the required environment variables set, but only after spending a few hours crawling over the configuration files that I don't rightly understand (we have other people in the company to handle deployment, I just write the damn code).
My second task is to get the application running off of the IBM DB2 development database. I contact the DBA and ask him for the connection details. He is a bit reluctant at first, "why do you need to know that info?" but I explain to him that I'm working on bug fixes for the application. Okay, so he relents and gives me the info. I spend the next hour crawling the internet trying to figure out how to properly create a JDBC connection to a DB2 database (we are primarly an Oracle house, we've never used DB2 for anything, and I've certainly never touched it before). I finally find a very, very good walk through and start fiddling around. First things first, I use the command line tools to connect to the DB and look at the data. Great, everything's good. I write up the JDBC connection string (I'm starting to get the hang of this), slap it into my code to replace the in-memory database I had been using as a fill in, and restart the application server. Every time the app tries to connect to the DB, the damn thing stalls.
Crawling google, crawling google. I start to think that maybe my connection string is wrong, so I fiddle around with it. Unfortunately, I determine that I had it *right*, because any time it was explicitly *wrong," the app would throw an Exception (as one would expect, actually). It's only when I have the correct connection details that the app hangs on me.
I went out on the web looking for bug info on the jdbc drivers. So, I start by looking up version numbers. Excellent, the database is running v8.2.2 and my workstation has the v7.2.3 client installed. Google revealse that the 7.2.3 *thin client* driver has a bug that causes the application to hang when one attempts to connect to a higher version database. The *thick client* driver does not have this bug. The thick client driver is not well suited to the task (the second user to visit the site will not be able to use it because the next application context will not be able to load the drivers, as the thick client locks them once they are loaded), but for development I can work with it until we upgrade the client on the workstation.
After a while of working in this way, suddenly it stops working, I'm getting Access Denied errors. I can't even use the command line tools anymore, either. It's getting pretty late though, so I went home.
The next day, I get an angry call from the DBA, chewing me out for using the production database for development. Apparently it through a security flag and locked itself down, which prompted a few hundred managers across the state to call this them and complain when they couldn't login to do their daily work. I appologize profusely, and ask for the connection details to the development database. He replies "I still have to set it up." The project manager behind me turns to me and says "that was supposed to have been done weeks ago" and I agree, it was one of the conditions that had to be met before we would come work on site. So, I call my boss (well, I try to, I never reached him, but that's a different story), and we stop work. For the next week. It took the DBA an entire week to get the development database up and running. Luckily it was the week I was on vacation, so I didn't miss much.
At this point, I need to back up and take you down another branch in the story. Before the database locked itself down, I was able to get a good amount of work done. I came to a defect in the list that I couldn't quite figure out how to reproduce. So, after half an hour of phone calls, I eventually located someone that knew how to reproduce the bug. He showed me on the live application. While he is doing this, I'm noticing certain things, like the lack of certain bugs that I had made mental notes to fix. It's a little confusing, but I chalk it up to the fact that we hadn't been running on the DB2 database yet, maybe that was the source of the bugs. If only it were that simple.
While on vacation, I get a call from my boss. He has noticed the same thing, did a little checking on some file dates here and there, and reallized that *we didn't get the latest cut of the code*. Another work stop while the lackeys hunt down the latest code. They have no source control, and the last work done on the app was almost 2 years ago. After another week, they locate a number of different folders labeled as "backups". My boss looked through them briefly (he was heading out for a business trip, another client in North Dakota), and figured that one particular one looked like it might be the full code.
I get there today and start looking at it. There are 5 folders, and not a single one of them have the entire application. The full app is there, spread out in bits and pieces, but not all together. Additionally, some of the backup folders have newer files than others, all the changes overlap between the 5 folders. There are so many badly named backup folders and renamed files (main.jsp, main0.jsp, main.jsp.old, copy of main.jsp, you get the idea) that some files have as many as 9 distinct versions running around. All of the files have at least 3 versions, judging from file size and time stamp. So, I start piecing together a full application from the files with the latest time stamps (shit, windows find utility won't open). I get them all together, setup the application, and then reallize that these various backup folders might represent numerous different "forks" of the app from the LAST time they lost the latest source code.
I'm now in the process of trying to figure out what is the "real code." I started by comparing file sizes in bytes and time stamps. If both values are equivalent, then it's a pretty good bet that they are two copies of the same file. I now have anywhere from 3 to 9 copies of each file. I'm going through and running a file comparison utility (actually, I didn't know CMD had one until now, called FC.EXE) on them to see if files with different time stamps aren't duplicates. 9 versions of one file needs at most 8+7+6+5+4+3+2+1 = 36 comparisons (#1 to #2, #1 to #3, #1 to #4, ..., #7 to #9, #8 to #9). Multiply out by a few hundred files. It took me 6 hours to get through half of them. I still have the other half to go. I need to do it tonight so that the code is ready for the one other developer that is going to work on Saturday to try to make up some lost time.