Recently I have came across an excellent book on how to develop code with testing in mind, and I wanted to share it with you. The book is called Growing Object-Oriented Software, Guided by Tests and is written by Steve Freeman and Nat Pryce.
The book starts right at the beggining as to why we want to develop test first and covers advanced topics such as testing persistance, threads, and asynchronous code. I particulary like the style with which the book delivers the message. They start by building a simple application and add new requirements to it, morphing the codebase in the process. As they do so they introduce new classes and walk the reader through the thought process considering alternatives finally choosing a solution. This gives the reader a good understanding as to what to think about when looking at code. Of course all of these changes are driven by tests, and a lot of discussion is spent on explaining why a test was written in a particular way and how to refactor it as it grows with the applications, so that tests do not become a liability.
Reading the book I sometimes felt that I was listening to myself, especially when the authors warned about global state, singletons, overusing mocks, and doing work in constructors among other things. But unlike myself, who draws sharp lines between right and wrong, the authors did a good job of presenting things on the gray scale of benefits and drawbacks. The book shows what a typical code most people will write, and then show how tests point a way towards refactoring.
If you are newbie, or an intermediate to developing with tests than this book is a must for your library!
8 responses so far ↓
igorbrejc.net » Fresh Catch For January 7th // Jan 7, 2010 at 1:02 am
[...] Growing Object-Oriented Software, Guided by Tests [...]
I agree! I’m currently reading it, and it’s being a great reading!
I’m currently reading it on my newly Kindle and I’m enjoying it a lot! A friend of mine (Matteo) suggested it to me and I find this book a very good guide for whom as me is starting to explore the beautiful world of code designing guided by tests! I’m very excited about this.
Weekly Links #1 | geekcloud.org // Jan 9, 2010 at 5:29 am
[...] Growing Object-Oriented Software, Guided by Tests Miško Hevery mit einer kleinen Rezension zum Buch Growing Object-Oriented Software, Guided by Tests (Beck Signature), welches als nächstes auf meiner Einkaufsliste steht. [...]
I have read this book (one should study it actually) and I must say – it is really great! They do not repeat the usual slogans, but explain everything from scratch. They also gives many many solutions for little and big problems one can get when doing TDD.
Swiss army knife for XP PHP projects (defining code quality) | Alternate Illusion // Mar 25, 2010 at 10:51 am
[...] Recently I have came across an excellent book on how to develop code with testing in mind, and I wanted to share it with you. The book is called Growing Object-Oriented Software, Guided by Tests and is written by Steve Freeman and Nat Pryce. via Miško Hevery [...]
Growing object-oriented software review | RefreshTheNet // May 20, 2010 at 12:15 am
[...] Skeleton and Acceptance TDD — were very enlightening. I guess there is a reason why Misko Hevery recommends this book: ‘Reading the book I sometimes felt that I was listening to myself, especially when the [...]
I’ve read the e-book third times before bought a paper copy
The book is just great and it’s increased my OOD and what good testing really is a lot. Thanks the authors!