Work through a common multithreaded XML transformation problem in Java. Along the way, you'll learn why getting a software program working is just Step 1 in a series of steps to produce good software.

by Todd Lauinger

May 29, 2007

Page 5 of 5

Step 1: Got It Working!
Now the real fun starts when you execute the multithreaded program on a multiple CPU server. I was able to run the program on a server with four dual-core, single-thread CPUs and the run time decreased to just over 30 seconds. Memory consumption was a modest 20 MB, a very small fraction of the Iteration 1 big bang transformation program.

The output file was identical in size to the big bang transformation, but the contents were not. You did not take the time to order the output in this article so that is to be expected. However, the XML generated was in tact for all records in the file; they were just ordered differently. So you can declare victory, Step 1 is complete!

However, only novice software developers stop at Step 1. Disciplined developers quickly move on to estimate the lifetime of the code they just got to work. The longer the code is expected to live, the more effort they spend on the code. Each step has a goal in mind that increases the usefulness of the code to extend its lifetime:

Get the code working

Get the code understandable  Goal: allow others to maintain and enhance the code

Get the code "debuggable"  Goal: minimize support efforts and production downtime

Get the code efficient  Goal: improve the efficiency of the code so that it has acceptable response times and is scalable to support large volumes and/or users

Get the code automation testable  Goal: manage the increasing size and complexity of a system; combat system entropy

Get the code reusable  Goal: have more than one product offering use the same code; ease the maintenance burden and come out with more products more quickly

You got through Step 1; hopefully you found the programming exercise challenging and you are ready to move on to Step 2!