Categories
Programming

More Parameters != More Better

Guilty as charged – my very early code was littered with functions with horrendously long signatures. All the worse in PHP, which doesn’t have a meaningful way to overload functions. Too many parameters means your function is likely trying to do too many things, instead of doing any one thing well.

A simple way to make your code better: Stop adding more parameters

Parameters are good, but there are some things that you need to consider when creating functions with parameters, or when adding parameters to existing ones.