News for hackers. Stuff that matters.
Re:Good code needs few unit tests by Confusion on Saturday March 20, 2010 @05:46AM (#1206256)

  - One quality measure of an abstraction is the complexity
    ofits interface (ie API size).
  - Another measure is the amount of state the abstraction
    encapsulates.
The simplest abstraction of many interfaces is two methods:

  setParameterForNextCall(paramName, paramValue)
  call(functionName)
The API is small, not complex and the amount of state is small, given that parameters are only set right before a call, all parameters are cleared after every call and no other state is retained. Yet it's clear to anyone that this isn't a good abstraction and that it doesn't result in an implementation that requires few unit tests. It requires an immense amount of documentation and allows a great many variations that yield bad/unexpected results.

  Hence, good abstractions require few unit tests.
Abstractions don't have unit tests: implementations have unit tests. It's the size and complexity of the implementation made possible by the abstraction that matters.
Re:Good code needs few unit tests by ekiru on Saturday March 20, 2010 @03:31PM (#1206852)
That interface is certainly inconvenient to use, and potentially quite dangerous without a clearParameters().

It's not at all a rebuttal of the article, though. The article points out that the number of unit tests a design requires is larger for more complicated designs. An interface like yours would require no fewer tests than another interface exposing the same functionality using conventional function calls.