Object orientation (OO) is not a trendy concept anymore, but it hasn’t certainly lost it values. The purpose of the book “Growing Object-Oriented Software, Guided by Tests” is to integrate the development of object-oriented software with the Agile testing Test-Driven Development (TDD) approach, more specifically in Java. It starts with an introduction to TDD and the open source testing tools (Junit, jMock2) that will be used in the examples. Then, it describes in detail the TDD process that is then illustrated by a large example. The book ends with more software testing topics like tests smells or tests readability. A final part is dedicated to special aspects of testing Java code like persistence, threads and asynchronous code.
The book “Growing Object-Oriented Software, Guided by Tests” written by Steve Freeman and Nat Pryce could be read from start to end or be used as a reference book. In the preface, the authors say that the book is intended for developers with professional experience and some first knowledge of TDD. It really goes far beyond “toy” examples that you can find in programming learning books to write your first “Hello Word” program. The content is a balanced mix of concepts, examples and diagrams that makes it easy to read. Besides what could be considered “catchy” acronyms (OO+TDD), this book is an excellent reference on how to design and program software (the authors use the nice concept of “growing” software). I will consider this book as a must-read for anyone programming in Java, but it is also recommended it to people programming in other languages and interested in software quality, as the thinking process could be applied in other contexts and with similar tools.
Reference: “Growing Object-Oriented Software, Guided by Tests”, Steve Freeman, Nat Pryce, Addison-Wesley
Book website: http://www.growing-object-oriented-software.com/
Quotes
What if software wasn’t “made”, like we make a paper airplane – finish folding it and fly it away? What if, instead, we treated software more like a valuable, productive plant, to be nurtured, pruned, harvested, fertilized, and watered? Traditional farmers know how to keep plants productive for decades or even centuries. How would software development be different if we treated our programs the same way?
As John Gall wrote in “The Systems Bible: The Beginner’s Guide to Systems Large and Small”: a complex system that works is invariably found to have evolved from a simple system that works.
Sometimes we find it difficult to write a test for some functionality we want to add to our code. In our experience, this usually means that our design can be improved – perhaps the class is too tightly coupled to its environment or does not have clear responsibilities. When this happens, we first check whether it’s an opportunity to improve our code, before working around the design by making the test more complicated or using more sophisticated tools. We’ve found that the qualities that make an object easy to test also make our code responsive to change.