on November 25, 2009
There are many books about Test-Driven Development on the market, but this book is unique. It presents a style of TDD which originated in the London software development community. It's a style which pushes several key ideas to the extreme: "tell, don't ask" object design, fully end-to-end incremental development, and the deep synergy between testability and good design. Steve and Nat have done a stellar job refining and presenting these ideas. The text is lucid and precise. When you read this book you'll be exposed to far more than just another style of TDD, you'll be exposed to a depth of insight about emergent object oriented design which is both rare and extremely valuable.
on January 13, 2010
This book has been in my Amazon pre-ordered list for quite a while and I was looking forward to this. I found the title alone already excellent. Steven and Nat (authors of jMock) are well known expert TDD practitioners, so I was looking forward to what they had to say. The book was better than I had expected.
The book consists of 5 parts. The first part of a very quick introduction to TDD and jMock. The second part discusses the tdd cycle in more detail. The third part (150 pages) is a very large example of growing a piece of software. The fourth part discusses topics on how to sustain TDD and the last part covers some advanced topics.
In this review, I'll skip part 1 as it was short and nothing special. Part two covers the TDD cycle and the link to evolutionary design. Steve and Nat have a design style that focuses almost purely on the interactions between classes which are most frequently tested using expectations on mock objects (which, as authors of jMock, they have lots of experience with). Most notable from part 2, for me, were the classifications of objects that they used, the strong focus on interaction and mocking (more than I usually have when test-driving) and their lack of focus on classes but focus on roles and responsibilities. Nat and Steve clarify their thinking exceptionally well which makes it all easy to understand.
Part 3 takes the largest part of the book, which is where they test-drive an AuctionSniper application. It is a small application, but large for a book example. The authors show how they gradually build up the application by adding one test at the time and how they gained insights during this process which made them adjust their design. I had mixed feelings about this part as a book didn't seem like the best medium for doing this, but still I appreciate the insights they had and also their attempt to make it as close to "real world" as possible.
Writing tests is one thing, maintaining them in another. Part 4 discusses how to make the tests maintainable and the tdd cycle sustainable. Personally, I found this part very insightful and the authors discipline exemplar. The authors start of with different test smells and what to do about it. They then discuss readability of the tests and of the error messages and spend some time of test object creation. Most notable from that part (for me) was their focus on using builders for creating test data, rather than object mothers.
The final part covers three (or actually two!) advanced topics. First is testing persistence where most interesting was how the authors seemed to prefer to "go all the way" whereas the common advise (for test speed) is to rollback and mock more. (this was actually a common theme in their book). The last two chapters deal with multi-threading and async code. I was unclear why these were separated in two chapters and they they were in this particular order. The content was excellent though, except that I missed some typical design guidelines related to multi-threading design. It almost felt they were in a hurry to write the last two chapters...
Anyways, in conclusion, this will definitively be one of my favorite (if not the favorite) TDD books and general design books. Steven and Nat did a wonderful job on this one. Though the book is not perfect, I enjoyed it thoroughly. A definite recommendation for anyone interested in modern design and TDD.
on November 26, 2012
This is a GREAT book... one of those you don't wanna stop reading. But the kindle version sux so bad that I gave up when I saw the first code samples...
A programming book with code samples that are almost impossible to read is a huge drawback. 70% of the value is lost in the kindle version.. I am sure that sooner or later this will be fixed but until then... stick to the printed version.
on December 17, 2009
In a way this book presents the essence of a decade of test-driven development practice. The authors bring together the various tools of uptodate TDD like mock objects, bdd-style naming and acceptance tests. Open the book on any chapter and you will most likely find useful and deep advice, even if you consider yourself already a TDD expert.
There's one catch, though, that made me lower the rating to 4 stars: The authors go for an extended example which covers the full TDD cycle; from a walking skeleton, to the first acceptance test, into many obvious and some non-obvious refactorings. As noble as this endeavour is, it didn't work for me as a reader. Coming back to the text - and the code - after a day or two I often got lost trying to grasp the subtle nuances; I just couldn't remember all the necessary details of previous chapters.
Nonetheless, it's an excellent book and I enjoyed it. Get a copy, read it and become a better TDD practitioner.
on June 20, 2011
The person who handed me this book said it was "better than Lasse's book" (Test Driven.) I disagree. One can't compare the two books - Test Driven is meant for beginners and this book is meant for an advanced audience. If you have never written unit tests before, this book is very hard to follow. So put it down, get an intro book and come back.
I really liked the emphasis on making the software responsive to change along with separating acceptance and unit tests. The book uses Junit 4.6 and therefore covers Hamcrest matchers for both JUnit and JMock. I like the authors cover best practices, good design and clearly indicate what is a personal preference. I really liked part 4's emphasis on things that are hard to test at a higher level than "extract method."
The only thing that prevents me from giving full marks, is the case study. While I did read this part in one sitting, it was still hard to follow. There was a lot of information to keep in mind while trying to focus on the lessons of the example. I also think it was admirable for the authors to use a Swing example since Swing is harder to test. However, Swing is also less common for Java developers to use actively adding another block to understanding the software growing/testing aspects. And it is even harder for non-Java developers who are in the target audience for the book.
Except for the case study, I thought the book was amazing. And I'm sure the case study is a matter of taste.
Disclosure: I received a copy of this book from the publisher in exchange for writing this review on behalf of CodeRanch.
on January 3, 2013
Growing Object Oriented Software, Guided by Tests, by Steve Freeman and Nat Pryce is a TDD book, but unlike any other on the market today. First of all, the book deals mostly with advanced unit testing topics, such as designing tests for readability and mocking, and addresses many common stumbling points that people experience with unit testing a few years after they started their journey, such as applying unit testing in multi-threaded and asynchronous environments. Second, it explains and demonstrates in practice the dynamics of designing software through TDD, which is still a dark art for many programmers. And third, it gives the reader insight into Freeman's and Pryce's minds, which is why this book is a must-read for anyone serious about unit testing, even for people that have been practicing it every day for the last 10 years.
Given the authors' backgrounds, it's not surprising that this book has a lot to say about using mock object libraries. Mock objects are arguably the most misunderstood and misused concept in software development today, so this book should be a valuable resource for most software development teams. In the part dealing with mock objects you will find strategies for using them successfully for software design, guidelines what to mock and what not to mock and lots of examples how all that looks in code.
The book isn't written in the usual imperative way ("you should use this because of...") but reads much more as an experience report ("we use this because of"). This might be unusual at first but I really like it, as it puts the things into a different perspective and lets readers make their own conclusions. Many of the topics addressed by this book are quite controversial and the authors have wisely chosen the voice to avoid any notion of preaching. I found myself disagreeing with parts, especially around bundling acceptance and end-to-end testing together. However, as the material doesn't preach but tell what the authors are thinking about, this did not bother me at all.
All in all, an excellent book
on February 22, 2013
I spent the first part of my career doing computational work, primarily in FORTRAN and C, before jumping into traditional "application development" about 18 months ago. My academic work consisted of applied math and statistical work; I knew precious little of being a quality "engineer" beyond proper syntax then. This book was a game changer for me.
What I discovered was that I was thinking about tests the wrong way. In my current shop, I often got frustrated at what was, I was thrilled to discover, a completely pointless test that felt like coding pablum to make the CI server happy with "test coverage". Genuine testing is much, much more. A dev that genuinely embraces TDD, and doesn't use it as a mere add on on his/her resume, won't be doing "Test Driven Development" but really "Test Driven Design". Some of the important higher level concepts this includes are:
1.) Listening to tests to create a more supple architecture.
2.) How to avoid "gold plating" features ( a big one for me )
3.) Using tests to describe the action of the object.
4.) Using syntactic sugar to make your exposed API far more readable to a future reader
5.) Spectacularly compact APIs
6.) If you've done XP, "ping pong" development is a real pleasure ( one writes the test, the other is forced to implement the feature to make the test pass, then they switch roles ).
7.) Focusing on the "message" an object passes to its peers or its delegators, which puts OOP in an entirely new light to me.
The standard "implementation tools" are also covered in depth to give you the ability to do the things listed above. Can't recommend it strongly enough.
on May 18, 2010
The book "Growing Object-Oriented Software, Guided by Tests" By Steve Freeman and Nat Pryce is packed with so many extremely useful information about writing object-oriented software with tests that I once had to stop reading it as I was afraid I would have gotten a bit carried away. Each and every page has its purpose. Each presented me profound wisdom of Test-Driven Development (TDD) and during the time of its reading I couldn't stop wondering when and how to apply it in my development activities (I still haven't, but am working on it). It's without a doubt a very informatory book about practices and theories behind TDD and jMock. There is no excuse for skipping the book while developing your software as well as software development career itself.
The book consists of 5 parts, 27 chapters, 3 appendixes and almost 350 pages. After 8 informatory chapters of the Part I: "Introduction" and Part II: "The Process of Test-Driven Development", the Part III: "Working Example" appears in which you will learn what it is to write an exceptional book about TDD by its practitioners. It was then when I let myself take some time off reading the book. Following the Part 3's chapters strained every nerve of mine to fully understand the TDD concepts. The authors did a good job of explaining TDD theory focusing on its practical aspects like early feedback, code quality, readability and maintenance.
It's definitely not a book that you read and forget. It is one that you read and never forget. It is one that requires a lot of attention on your part and leaves no stones unturned in pursuing well-thought-out object-oriented software development. The last Part V: "Advanced Topics" was quite hard to follow, perhaps because it touched the concurrency and asynchrony concepts I'm not very good at and interested in. I then enjoyed the Afterword: "A Brief History of Mock Objects" where I learnt the history of jMock in quite a humorous way. Opening each chapter with a motto was highly motivational and made the reading even more enjoyable experience.
I think it'd be better off if the book became a mandatory reading for all who wish to master the art of object-oriented software development.
on July 13, 2013
Definitely a must read if you're looking for state-of-the-art test-first practices to develop an application.
One small downside though - part 3, where an extended example is explained, is one of the hardest reads I experienced in a programming book. Not that the code itself is rocket science, but it's basically like a mystery novel with an intricate plot - if you have several spare hours to spend, you could read it all in a row and find it a blast. If instead you read it periodically like I did, you'll often find yourself going back several pages to try to remember who's that character/class again and struggling to get your head around the pieces of the puzzle. This might be because I wasn't familiar with JMock or any of the tools used in the example application, but I also found it was easy to get lost in details since what we've got is basically the authors' raw thought process, with overall not much stepping back, recapitulating and connecting to theory from previous chapters.
on January 28, 2011
The first part of this book seemed scattered, jumping all over the place and making a lot of reference to things which weren't defined until later in the book. However, once you get used to the style, this book jumps off a cliff and hits a lot of great topics, and hits them in depth.
Tooling, design, culture, methodologies - it's all covered, and it's covered fairly well. I particularly enjoyed the authors carrying the same detailed, practical example through the book. Too many software books use trivial examples specific to one topic. Freeman and Price evolve an "Auction Sniper" as they go through the book; the consistency is a great asset.
I also enjoyed the authors speaking emphatically about using acceptance tests as the starting point for features, not just unit tests. There's an important differentiation between acceptance and unit tests, and the authors specifically call out acceptance tests "using only terminology from the application's domain" - speaking to the feature's business driver, not the underlying technology.
Also as critical to me is the authors' emphasis on keeping the test side of the codebase clean. Your tests ARE production code. Treat them with the same approach about solid design and refactoring as you treat the code you're deploying to your customers.
This isn't a simple 100-level book. The authors dive deep in to design, practices, and lifecycle. They do it well enough that they'll hook newcomers to testing as well as teach accomplished folks new things too.