Skip to main content

Getting Testy

Posted by daniel on March 3, 2004 at 5:22 AM PST

"The days of hacking out barely acceptable code are over."

At least according to Andy Hunt in his March 1 blog entry What is Unit Testing . Andy is nearly always right and I hope he is right this time but I am pretty certain that he isn't. As my friend Chris Butler used to say "you can't push a string". Andy is arguing that market conditions will require that we no longer pay for developers who can't, um, develop. He's responding to "posters who claim that unit testing is just the same as debugging, or that unit testing contributes to code bloat, or that it's stupid, or a waste of time, or that real coders don't bother with such things, and a lot of other nonsense."

It makes his blood boil. He knows that many would benefit from unit testing. It bothers him that "Unit testing is a powerful technique that allows you to write better code, but many programmers won't even try it." He suggests that the problem may be the word "testing" in the name. As Mike Clark pointed out in his article A Dozen Ways to Get the Testing Bug in the New Year, test first development is about design.

I've been learning ObjectiveC lately and recently purchased a copy of Brad Cox 1986 book Object Oriented Programming: An Evolutionary Approach. Nearly twenty years ago Cox wrote:

[T]he next step is to decide what each entity should do. I find it helpful to adopt the consumer's point of view at this stage and record decisions in the form of code fragments that demonstrate how each component in the design would be used.

And that is what test driven development is all about. You adopt the consumer's point of view when you write unit tests. You ask "what will I call" and "what do I want it to do". Those are your tests. You can see that these aren't tests so much as an executable design.

There is a second set of tests that should also drive your development process. These are customer written tests. A couple of years ago at MacHack a member of the Apple iPod team told of their "customer" driven development. Each Friday Steve Jobs would take the latest version of the iPod home and play with it over the weekend and each Monday he would have notes of things he wanted changed or improved. These are just a higher level of Cox's taking the customer point of view. Now you aren't a customer of the code but a customer of the product or application.

You will find PDFs of tutorials for each of these test first techniques in Featured Articles. In Extreme Software Engineering: A Hands-On Approach , Prentice Hall has allowed us to offer two of my introductory tutorials from a book I co-wrote with Daniel W. Palmer.

In today's
Weblogs , Stephen Montgomery joins us as a blogger. He has some thoughts on Java vs Perl for Bioinformatics. In training bioinformaticians, Stephen writes, educators must consider "How do you rapidly give a novice computer user the experience and wherewithal to design and write computer programs? Furthermore, how do you teach them about programming without intimidating them?"

We think of P2P as being "about creating ad-hoc networks and the dynamic discovery services and resources" write Daniel Brookshier in If you already know about a P2P service, is that Bad? In this post he is presenting ideas for the use of an ID in JXTA and why it doesn't violate the dynamic nature of a P2P network. At one point he mentions that Discovery is "a little inefficient for data searches". Is the addition of Binary IDs the analogue of primitives in Java?

In today's Projects and Communities , the Linux community editor, Chris DiBona, blogs about his experience learning the Java Programming Language and feeling overwhelmed by the acronyms.

Daniel Brookshier asks if JXTA is important or just cool. He answers that it is both and that " the benefits of P2P, and the reduced costs are enormous and they add up over the lifetime of a product."

Also in Java Today
, JBoss comes preconfigured to be used with HypersonicDB. If you are looking to use a different database, check out Deepak Vohra's ONJava article Configuring JBoss 4.0 JDBC Connectivity . He provides configuration instructions for Oracle, MySQL, Sybase, DB2, and Informix.

Joel Spolsky shares his Top Twelve Tips for Running a Beta Test . How many cycles, how long should each be, how many testers, how open ... this is a quick look at what you should consider before running a beta of your software. For example Joel recommends you "try to get 100 serious testers for every employee that is available to handle feedback."

In today's News Headlines

Registered users can submit news items for the href=""> News Page using
our news submission
. All submissions go through an editorial review by news director
Steve Mallet before being posted to the site. You can also subscribe to
News RSS feed

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the
Today RSS feed
. All members can subscribe to the email
updates for the site at the href="">
java-net Mailing Lists page. You must be logged in to subscribe
the javanet_Daily and javanet_Weekly lists. Also, once this page
is no longer featured as the front page of
it will be archived along with other past issues in the href=""> Archive.