Object orientation (OO) is not a trendy concept these days, but it hasn’t certainly lost it values. The purpose of this book is to integrate the development of object oriented software with the test-driven development (TDD) approach, more specifically in Java. It starts with an introduction to TDD and the tools (Junit, jMock2) that will be used. It describes then 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 like persistence, threads and asynchronous code.
The book 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. 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 it a must for anyone programming in Java, but I will also recommend it to people programming in other languages, 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, 358 pages, ISBN 978-0-321-50362-7
“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 systems 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.”