Run Me Now!

This snippet isn’t so much about code quality, but rather about how NOT to name your functions.

While reviewing plugins on tonight, I found a plugin that contained a function named run(), like this:

function run() {
    // do stuff here . . . code omitted

This is a really poor name for a function (unless it’s inside a class) because it’s too simple and too likely to cause a fatal conflict with other code running on a site.

Think for a moment, which is more likely to happen twice: a function named mysuperprefix_run() or just run()? Obviously the second.

This is just a lesson in prefixing your procedural function names.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s