[rspec-users] spec-ing private methods?
ashley.moran at patchspace.co.uk
Wed Oct 14 16:47:10 EDT 2009
On 14 Oct 2009, at 21:31, Stephen Eley wrote:
> I disagree that the simple existence of private methods is a sign of a
> design flaw. There are plenty of use cases for which private methods
> are the simplest and most practical approach. I use them all the time
> to help me deconstruct complicated multi-step actions into shorter,
> more atomic chunks of logic.
> They're also not usually that complex or brittle.
I don't think Scott meant to imply that private methods are bad, only
that complex ones private methods are. I use private methods for the
same reason you describe above, to break complex actions down into
more understandable chunks. When it takes 30 private methods before I
can understand the code, that usually indicates there's a problem, and
that a new class needs to emerge. (There are usually other signs of
this too, though.)
More information about the rspec-users