Inércia Sensorial

24 de July de 2006

What does this function test?

Filed under: Perils of Software Development — inerte @ 15:51

A function wrote by a co-worker:

1
2
3
4
5
6
7
8
9
10
11
function test($what, $where) {
    if (!empty($where)) {
        if (!empty($where[$what])) {
            return $where[$what];
        } else {
            return '';
        }
    } else {
        return '';
    }
}

When I had a look at this function I immediatlly tought: Test? What does it test? Thankfully there’s the $what argument! And look! A $where argument too!

WTF? Folks, name your functions and variables properly.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress