摘譯自:
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.
函數參數
函數參數的理想個數是零個(零元)。
其次是一個(一元),
緊接下來是兩個(二元)。
三個參數(三元)應盡可能地避免。
三個以上的參數(多元)需要非常特殊的理由
————否則無論如何都不應該。
(轉載請注明來源于金慶的專欄)
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.
函數參數
函數參數的理想個數是零個(零元)。
其次是一個(一元),
緊接下來是兩個(二元)。
三個參數(三元)應盡可能地避免。
三個以上的參數(多元)需要非常特殊的理由
————否則無論如何都不應該。
(轉載請注明來源于金慶的專欄)