函数参数的理想个数

摘译自:

Clean Code
A Handbook of Agile
Software Craftsmanship
Robert C. Martin


Function Arguments

The ideal number of arguments for a function is
zero (niladic). Next comes one (monadic), followed
closely by two (dyadic). Three arguments (triadic)
should be avoided where possible. More than three
(polyadic) requires very special justification—and
then shouldn’t be used anyway.

函数参数

函数参数的理想个数是零个(零元)。
其次是一个(一元),
紧接下来是两个(二元)。
三个参数(三元)应尽可能地避免。
三个以上的参数(多元)需要非常特殊的理由
————否则无论如何都不应该。

(转载请注明来源于金庆的专栏)

你可能感兴趣的:(C++,c,C#)