Pass The Buck Antipattern

Perfectly factored code contains only one line per method. This line delegates the work to another object. Because the receiving method is (of course) perfectly factored too, it's only one line that, in turn, passes the buck.

Following this AntiPattern, your code soon becomes a nest of strands of buck-passing.

The rule "DontTestGettersAndSetters?" does not apply to buck passers. Therefore the majority of your tests will never fail unless the actual buck-receiver fails.

ItDepends. Perfectly factored code of one-liners need not be an AntiPattern. The delegation may add something usefulnamely type information and do something useful namely dispatch conditionally. And you indeed don't need to write tests for these as the type system already is your test (provided you use a TypeSafe language).

See The BuckStopsHere.

Contrast with ContractiveDelegation.

View edit of June 20, 2008 or FindPage with title or text search