Last night I finally Finished chapter five in my upcoming book about unit testing. Chapter five was all about Mock Object frameworks and was the longest and hardest to write so far. Some of the reasons it was hard to write this:
- It took me a long time to decide which mock framework I'll be using for my examples. I ended up choosing Rhino.Mocks after running this little survey on my blog. The truth is, the Mocking framework scene in .NET is not as great as it could be (I.e it sucks). Most of the big free frameworks are not being actively developed (EasyMock, NMock and NMock2), and the ones who are active are basically a one person army which is also bad (Rhino.Mocks is that). The only good framework that would fit the book in terms of both features and long lasting supportability security is TypeMock which is commercial so I did not want to use it. Rhino Mocks came a close second with feature set and active development, but it's still a one person show for now which makes it dangerous to use in a book (who knows where it will be in a year).
- It took me a long time to figure out how to really explain my thoughts on mock frameworks vs. hand written mocks and stub, and what features I should cover vs. what features I should leave out. The most important features are there, but I am leaving a "hardcore" review of RhinoMocks itself for an appendix chapter that will be written by Ayende himself.
- Taking care of a new baby and doing full time work can be challenging even without writing a book. That meant the book writing kept getting delayed.
- The chapter is long for what I've had so far (23 word pages). I've seen longer chapters, but for me it's been a struggle with all these problems, and I kept pushing it further and further.
- Now starts an even harder part - I get to review all the editing comments on all five of the chapters from my editors. It's a time taking labor of very tiny things, and it really bruises you ego when you encounter it for the first time, because it shows yo hundreds of problems with your writing, or it forces you to sometimes rewrite parts that were (to your mind) perfect. I have to get used to this.