Tuesday, June 28, 2011

When 55 arguments are just about enough!!

In Robert Martin’s “a.k.a Uncle Bob” Clean Code book, he classifies Niladic functions (that have Zero arguments) as the best well behaved functions that are ideal to write and deal with; Monadic and Dyadic functions (that have 1 and 2 arguments respectively) comes as a second best. Anything Polyadic (with more than three arguments) is just pure evil and requires justification.

I wonder though how he would feel about a function with 55 arguments!! The following is just the signature of this function

(Int32,Int32,String,Int32,Int32,String,Int32,Int32,String,Int32 ,String,String,String,Int32,Int32,String,Int32,String,Int32,String ,Int32,String,Int32,Int32,Int32,DateTime,DateTime,String,String ,DateTime,DateTime,String,String,DateTime,DateTime,String,String ,String,String,String,Decimal,Decimal,Decimal,Decimal,Decimal,Decimal ,Int32,Int32,Int32,Int32,Int32,Int32,String,Int32,String)

If I were to meet that developer who wrote that function, I would simply ask, WTF were you thinking!?

May we survive the coding horrors yet another day!