Tim Burns' Weblog - Fair and Balanced
 
Monday, August 25, 2003 [*]
 

Building an Enterprise Environment in Java with Free Software

Developers are very good at writing their own tools and so one can find a lot of high-quality free software for developing and maintaining software. I've found that I can create a first-rate development environment in about a half a day with entirely free and open-source software.

The above list covers the core software that any enterprise environment should be using. I've left out bug tracking, because I've generally used in-house bug tracking systems. It is an easy application to implement, so I'm sure that many good open-source bug tracking software is available.

Version Control

If there isn't an existing version control system, installing a version control should be the first step of implementing an enterprise environment. As you add features and functionality to your project, you will invariably make a mistake and want to look at exactly what changed. Having a nice version control system makes this easy. Because CVS is free it integrates many IDEs. In fact, since about 2000, I've come across an IDE that doesn't come with a CVS integration.

Ant

The development environment should always support a very low-tech build. If you can only build in the IDE, then you probably need a human to do the builds, everyone has to use the same IDE, and you will someday be hamstrung by the capabilities of the IDE. Ant is great because it is low-tech. I can have a development environment with VI and Ant and be quite productive. I can also automate my builds and tests.

Eclipse

I've sworn by many Java IDEs. First it was Borland JBuilder, but the licensing became draconian and too expensive. Then I switched to IntelliJ, which was cheaper, and had great refactoring features. Recently I switched to Eclipse as I started working with more educational and not-for-profit development shops. I find that it doesn't matter what IDE I use, as long as I know it very well. Since Ecplise is free you can download and use on any project - no matter what sort of monetary or bureaucratic obstacles you might have.

MySQL

If you are already using an enterprise-class database, ignore this step. I usually use Oracle and recommend it if you can afford the licensing, but MySQL is good, free alternative. Also, if you are being hosted by a third party, chances are that they use MySQL and not Oracle. Yahoo, for instance, includes MySQL database access in its standard web hosting product.

Tomcat

Tomcat is a good J2EE environment because it is simple and you can design web application software that focuses on doing the job.

Tomcat is by no means the only good servlet container. I am a big fan of Oracle Application Server, which is based on Orion. Orion is free for not-for-profit use.

I suspect that any of the application servers on the market right now are all rather good. My biggest gripe with J2EE is that there are a lot of unnecessarily complex APIs. My experience is that the simple implementation of the Struts MVC architecture using servlets is easier and faster. Don't bother with EJB, RMI, or the XML apis. They are really more trouble than they're worth. (For XML, use the struts digester class. Its effective, fast, and easy).

Struts

Struts is now the standard for the MVC in Java. It is simple to learn and easy to maintain. I use nearly aspect of Struts regularly. The template facility allows me to create modular JSP templates for a really clean, nice corporate web portal (the latest release calls them tiles (why can't developers just leave well alone - templates were fine). The HTTP connection processing code allows me to take a request, read the values from the form, do database queries and update the form. And the XML Digester is a very simple and powerful way to handle XML.

Log4J

Usually I like to use the internal java classes, but not in the case of Log4J. The logging API in java has some serious flaws and one just has to wonder, what was Sun thinking?

Logging is an invaluable tool in tracking the usage and finding bugs in a site. I've never found Log4J to hinder performance and I find that logging is an excellent complement to test-driven development with JUnit.

JUnit

If you've read this far with any interest, I'm sure you've heard of JUnit. JUnit is the very simple software behind test-driven development in Java. Basically instead of just writing your program, you write the test first. For example, say I want to write a class that handles the user data in the database. I would follow the following steps:

  1. Create a class called UserDAOTest that extends TestCase from the JUnit package.
  2. Write a test case that does what you want it to do.

    public void testValidateUser() throws Exception {
      try {
        Integer userKey = userDAO.find("testUser");
        userDAO.remove(userKey.intValue());
      } catch ( DAONotFoundException e ) {
        Category.getInstance(UserTestDAO.class).warn("Did not find test user");
      }
      Integer key = userDAO.create(new User("testUser", "helloWorld"));
      User user = userDAO.load(key.intValue());
      assertEquals("testUser", user.getUsername());
      // Always encrypt passwords
      assertEquals("PsncrsDzen0YY", user.getPassword());
    }

  3. Now implement the code to make that test succeed.
If you follow this model, then the longer you are on the project, the better the code will get. Classes will be better defined, you will be able to refactor out better designs, and you will be able to release to production with less anxiety. In fact, these days I really don't worry at all about releases - I have over 1000 unit tests on my web application!

Mock Objects for Struts

Unit testing database entity handlers like a user row is fairly strait forward. However, the front end web environment is based on a the struts of the Servlet definition. Since this is a unit test environment, I would like to be able to test without running an instance of Tomcat. The MockStrutsTestCase does that rather nicely and you follow the same process as descibed above.

HttpUnit

I haven't found much use in the unit testing area for HttpUnit, because the struts mock objects will tell me what I need to know about the processing of http requests. What it won't tell me is how those Http requests work on a real web system running under Tomcat. HttpUnit requires me to have a running site and will let me run automated tests on that site. I like to use it for stress testing or for finding threading and other kinds of problems.

The value of HttpUnit is that it doesn't do unit testing at all. It lets me step outside the system and test the actual use of the product. In the XP vernacular - acceptance testing. At this level, I look for some simple marker in the page and pass tests based on that marker. Mostly what I look for with HttpUnit is errors in the logs.

 
Comments [0]
 
Monday, August 18, 2003 [*]
 

When I first started blogging I felt I was so one-sided. All I wrote about was mushrooms. Since I've written about shopping, I now feel Fair and Balanced.
 
Comments [1]
 
Sunday, August 17, 2003 [*]
 

Foraging and Shopping

I'm a lousy shopper. Actually, I'm not just lousy, I hate it and I'm lousy and this goes through my head again and again as I walk through the megamall looking at one stupid store after another. I work myself into a frenzy this way and the longer I shop the worse it gets.

Today's visit to Providence Place for an important birthday present (my wife's) was outstanding. By the time I hit the third level I have must have had a look of desperation in my eye as I walked into yet another "unique and upscale" clothing store. The woman looked at me as if I was bleeding and said, "are you looking for someone?" I said "yes" before I understood that she meant was I looking for my wife who was lost. "No, I'm looking for something to buy my wife." She was helpful but by that time I was too far gone and everything just looked the same and way too small. I backed out, apologizing, and wandered through jewelry stores, stupid gifts, stupid heavy metal stores, and finally ended up at a place that sells stuff you might find at a local arts fest. By this time it was 5:59 on a Sunday and I had exactly one minute before the store would close. I bought a coffee canister for $65 knowing all the time that my wife would think it was "inappropriate". Oh well. I explained to her what happened and she really understood. I was thinking that maybe we could give it to someone as a wedding present sometime. Send me an email if anyone out there in web land is getting married and you need a nice coffee canister.

I once believed in existentialism, or at least my own, uninformed version of existentialism like a fanatic. I cut through everything in my life and really looked for what was real and tried to live like a Sartrean hero. I did this for three years and eventually I got lonely and decided that maybe one Other was okay. So I toned it down and met my wife. As I've gone forward in my life, I've come to believe in connections. I have a job and meet people -- even do cold calls and software consulting, but I've never lost that sense of disgust and disorientation when I'm in the thrall of something completely false.

Anyways, this evening I had that real existential moment thinking about what happened today. I felt like the guy in Nausea looking at the people going to church or the society people or the waiter. People that were just doing, but not in a real way. People substituting a made-up life for a real life. People that had just let society or someone else make them who they were and who weren't ever going to find who they were. I saw it and I felt and I just wanted to go take a picture of a mushroom.


It looks like I've misidentified my first mushroom! Russula mariae has a whitish or cream-white spore print and and whitish gills. My little purple friend below has a purplish gills turning rust and rust colored spores.

I'm cautiously optimistic that I've found a lovely patch of "Small Chanterelle" mushrooms or Cantharellus Minor. After mis-identifying the Cort I'm learning to appreciate the slogan: "There are old mushroomers and there are bold mushroomers, but there are no old, bold mushroomers."

I cooked up some Lobster mushrooms last night that I bought from Whole Foods. They were delicious. Even my wife enjoyed them, after first insisting she see the receipt to ensure that I actually bought the mushrooms and wasn't trying to pass off one of my collecting expeditions by putting it into a shopping bag.

 
Comments [2]
 
Wednesday, August 13, 2003 [*]
 

Mushrooms

It's been a rainy summer and the mushrooms have, well... mushroomed. I've always had a fascination with eating things I catch, kill, or find in the woods, and so I've been watching the little fungi hungrily. My wife, however, has a typical midwestern hysteria about eating mushrooms and told me she would be furious if I ever ate a mushroom that I did not buy in the grocery store. It's quite silly because there are really only a few deadly poisonous varieties. They are generally little brown mushrooms or whitish free gilled mushrooms of the Amanita family. One can easily avoid eating anything that falls into these two categories and find wonderful families of mushrooms that do not look anything like the deadly mushrooms, but are only mildly poisonous at worse.

After buying the a guide to mushrooms, I've been photographing and trying to identify the mushrooms that I see in our woods. Boletes are one of the great varieties whose most poisonous types will only give you an upset stomach. This lovely bolete is probably a "Burnt-orange Bolete" or Tylopilus ballouii which is edible, but has to be cooked a long time before the bitterness disappears.

Here is one that is just driving me crazy. It is a "Viscid Violet Cort" or Coirtinarious iodes "Purple-bloom Russula" or Russula mariae. My Audubon book says it is "Edible" "Good" and I'm sure it would look just lovely cooked up nicely in a salad. There are dozens of these along my morning run and they are just rotting back into the ground or getting eaten by critters.

 
Comments [0]
 
Friday, August 8, 2003 [*]
 

I'm amused to discover that there is a blog for everything. I took this picture of a swan living near my house and decided to look up what species it was. It is a Mute Swan or "Cygnus Olor". By the accounts of the Mute Swan Weblog, it is a pest. After watching them nest, I was disappointed that their clutch of eggs failed to hatch, but perhaps that is a good thing.
 
Comments [0]
 
Tuesday, August 5, 2003 [*]
 

The gem-du-jour is The Cathedral and the Bazaar.
 
Comments [0]
 

Articles

Non-Blocking Socket I/O in JDK 1.4

Generating Entity Beans with XSL Templates

 

Photos

Providence
Baby Shower
Camden, Maine
 

The Daily Chronic

Atrios
Bio Informatics
Brown News
Corante
Docnotes
Get Fuzzy
Howard Dean
Making it Stick
Philip Greenspun
PhotoMatt
Orcinus
Salon
Science Blog
Scientific American
Tom Tomorrow
Woods Hole News
 

References

Statistics

 

Archive

2003
July
June
2002
2001
 

Copyright 2001-2003 Owl Mountain Software, LLC. All Rights Reserved. xml