Negative Experimental Programming

September 21st, 2006

I’ve previously written about the benefits of experimental programming: fixing code until all tests pass without necessarily understanding at a theoretical level why they pass. This scares the bejeezus out of a lot of developers, but I’m convinced it’s going to be increasingly necessary as software grows more and more complex. The whole field of genetic algorithms is just an extreme example of this. Simulated annealing is another. However those techniques are primarily used by scientists who are accustomed to learning by experiment before they have a full and complete understanding of the underlying principles. Computer scientists are temperamentally closer to mathematicians, who almost never do experiments; and who certainly don’t trust the results of an experiment unless they can prove it theoretically.

However, perhaps it’s possible to introduce experimental programming in a slightly less controversial form. While many programmers may be unwilling to accept it as positive evidence of program correctness, it can offer undeniable evidence of program failure. This was recently brought to mind by a bug I was trying to fix in Jaxen.
Read the rest of this entry »

Fielded Input Considered Harmful

September 10th, 2006

I am so tired of programmers placing their convenience ahead of mine. They work for me, not the other way around! One common problem is input fields. For example, here’s a chunk of a web form I was asked to fill out when purchasing an upgrade to a product:

212 | 5553456
Read the rest of this entry »

Test Everything, No Matter How Simple

August 22nd, 2006

There are many reasons to write your tests first. An oft unmentioned benefit is that it makes the programmer stop and think about what they’re doing. More often than you’d expect, the obvious fix is not the right answer; and writing the test first can reveal that.

For example, recently Wolfgang Hoschek pointed out that in XOM the Attribute class’s setType() method was failing to check for null. Once he pointed it out, it was an obvious problem so I opened up Eclipse and got ready to fix it:
Read the rest of this entry »

Mounting a Server at User Login

August 21st, 2006

In the good old days of Mac OS 6, 7, 8, and 9, it was possible to automatically mount network drives at startup. This no longer seems to work in Mac OS X. There’s no longer a little box you can check when mounting a network drive to say, “items will be opened at system startup time”. You can still do this, but it takes a little more work. Here’s how:
Read the rest of this entry »

Eclipse Classpath Insanity

August 16th, 2006

Eclipse 3.2 is driving me nuts. For reasons I just can’t understand or debug, it keeps throwing NoClassDefFoundError when I try to run most code in my project:

Exception in thread "main" java.lang.NoClassDefFoundError: nu/xom/Element

However, it can compile the classes it complains about not finding just fine. There appears to be a disconnect between the path the compiler sees and what the interpreter sees.
Read the rest of this entry »