On API Design
Krzysztof points out that Rhino Mocks has 26(!) methods to create various mocks.
I was very surprised to hear that, so I took a look, and he is right. The problem is how you think about those. Those 26 methods are only applicable when you count each overload as a separate method. Without counting the overloads, we have 10 methods. Then we have to consider options. In Rhino Mocks, you tend to have the following options: Create mock, create mock with remoting, create mock from multiple types.
That works to reduce the amount of options that we have down to about 4 different types of mocks that Rhino Mocks can generate. And you know what. Almost all the time, you don't need to use them. You only have to use DynamicMock and that is it.
Krzysztof suggestion would consolidate all the options to a far smaller surface area, but it would have several major issues:
- Break backward compatibility - I am wiling to do that, but not without due consideration.
- Break the documentation - See previous point.
- Force the user to deal with all the options explicitly - "In your face!" API design, from my perspective. That would lead people to create utility methods over it, which gets us right back to all the method options.