Hello! I'm Daniel Bingham. I'm a software engineer, writer, permaculturist, and community organizer from Bloomington, IN. You can read my full CV or you can contact me via email.

Escape From Parameter Hell

posted on January 27, 2014 with comments

Originally published on EllisLab.com:

I’ve been doing a lot of interface design, of late. When first designing a system, it’s pretty easy to keep interfaces simple. It’s easy enough to write functions and methods such that they only need a few things:

function do_action(Person $person, $action){}

But as design progresses, or as you use a system, interfaces change. You need to pass more information. Parameters previously required become optional. Eventually, you end up with function signatures like this:

function do_action(
Person $person_doing,
Person $person_done_to = NULL,
$at_time = 'now',
$with_implement = 'voice',
$with_coconuts = FALSE,
$are_repressing_the_peasantry = TRUE)

Welcome to Parameter Hell…

Read more…

comments powered by Disqus