- Joined
- Apr 24, 2008
- Messages
- 17,844
- Likes received
- 990
- Thanks received
- 182
I agree with everything you said there, even though I go for small methods. I aim for single responsibility - at both class and method level. I don't think keeping methods small, per se, helps testability, because i factor the large methods out into smaller private methods - and I don't unit test private methods.
Class level single responsibility, though, tends to make testing easier as a side effect. Single reason to change = helpful, easier to test = bonus!
+1 on the not designing code for testability though (apart from special cases).
I very rarely ever write private methods and in fact I would have them banned, I cant see the point of splitting up a large public method into smaller private methods. It does make the readability of the code much worse as you have to use the IDE then to follow the code looking for calls rather than moving down one large method.