|
|
|
|
|
by narnarpapadaddy
471 days ago
|
|
Think of it more like a “complexity distribution.” Rarely, a function with a single line or an interface with a single element or a class hierarchy with a single parent and child is useful. Mostly, that abstraction is overhead. Often, a function with 5-20 lines or an interface 5-20 members or a class hierarchy with 5-20 children is a useful abstraction. That’s the sweet spot between too broad (function “doStuff”) and too narrow (function “callMomOnTheLandLine”). Sometimes, any of the above with the >20:1 complexity ratio are useful. It’s not a hard and fast rule. If your complexity ratio falls outside that range, think twice about your abstraction. |
|
Do I need 5-20 non-trivial test cases to cover the range of inputs this function accepts?
If yes, function is probably about the right level of behavioral complexity to add value and not overhead.
If I need only 1 test or if I need 200 tests it’s probably doing too much or too little.