Unit Testing in Java: How Tests Drive the Code

Most programs have a common problem: they want to save part of their state, (i.e., part of their objects), in certain moments to make sure they survive the end of the program run. This process is called persisting. In another moment, and frequently in another program run, persistent objects should eventually be taken back from their exile to operative use.
There are many options to make data and objects "durable" in Java. Typical variants include:
Saving the object attributes to a file(e.g., in XML format).
Serialization of an object graph in a stream.
Saving the objects to a relational database (RDBMS) with or without the use of a mapping tool. [1]
Using an object-oriented database (OODBMS).
A full discussion of the benefits and drawbacks of available persistence mechanisms goes beyond the scope of this book. These issues are covered in the literature [Barry96], which discusses in detail why and how an OODBMS can make our programming life easier. After all, we developers would like persistence to become a seamless part of object-oriented principles. In contrast, more than 10 years after the appearance of the first commercial object-oriented databases, most companies still favor their relational counterparts for software development, for good or bad reasons. In this chapter, we concentrate...