ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Furnaces and Databases

by Daniel H. Steinberg
ONJava Newsletter for 01/22/2004


I've been thinking a lot about testing lately. Last weekend, during a cold snap, our furnace wouldn't fire. There was nothing wrong with the actual furnace, but the safety mechanism thought that the water being returned to the furnace was hotter than allowable limits and so it kept the furnace from firing. I watched our furnace guy run his series of tests. He was able to quickly locate what had gone wrong and what he needed to fix. The furnace itself is a pretty simple mechanism. What was going wrong were the inputs to the furnace.

In testing these mechanisms it was so much easier to not have to fire up the furnace every time and make sure that the pump comes on and that everything turns off correctly much later when the correct temperature is reached. The same is true when programming with an application that depends on a database. You don't want to have to set up the database, check that everything is working properly, and then have to restore the database to its previous state. Andrew Glover writes about Effective Unit Testing with DbUnit. He explains that "With DbUnit, a database can be seeded with a desired data set before a test; moreover, at the completion of the test, the database can be placed back into its pre-test state."

Different tools give you different bits of insight into your software architecture. Sometimes Javadocs give you everything you need. Some developers prefer UML while others like to navigate code using a debugger. Glen Wilcox writes about Managing Your Dependencies with JDepend. As he explains, "JDepend analyzes the relationships between Java packages using the class files. Since packages represent cohesive building blocks of your architecture, maintaining a well-defined package structure provides insight into architectural qualities of maintainability, flexibility, and modularity. Packages also provide a useful mechanism for estimating the impact of requirements changes, so understanding their dependencies is useful in this respect as well."

Our java.net featured article is the latest installment of Bill Grosso's Explorations column. This time he wraps up his look at the generics specification by examining how Wildcards can add a great deal of flexibility. By using a wildcard as a type parameter you can signal to a client programmer that the type is not explicitly used in the body of the method. You can add flexibility to inheritance, and you can use wildcards in variable assignments.

To subscribe to the ONJava.com newsletter (or any O'Reilly Network newsletters), visit https://epoch.oreilly.com/account/default.orm and select the newsletters you wish to receive in your user profile (you'll need to log in with your existing O'Reilly Network account -- if you don't yet have an account, you'll need to create one).

To change your newsletter subscription options, please visit https://epoch.oreilly.com/account/default.orm and click the"Manage My Newsletters" link. For assistance, send help to

Until next week,

Daniel H Steinberg, editor
ONJava.com and java.net

ONJava.com News and Weblogs

java.net Weblogs

O'Reilly Network Java Weblogs

Other Java News (channel -- LANG: JAVA)

Java Cookbook Recipe of the Day

Java Events

Other Related O'Reilly Network sites

O'Reilly Network



O'Reilly and Associates

O'Reilly Java

ONJava.com Affiliates