[wp-hackers] Coding Standards: Functions vs. Classes

Brad Touesnard brad at touesnard.com
Sun Mar 18 00:39:57 UTC 2012

It seems there's two competing views on whether a set of functions or a
class should be used in core. For example, the relatively recent transients
API is a set of functions, but could have just as easily been a class. Is
there some reasoning behind the decision to use a set of functions instead
of a class? Or is it coders choice?

To be clear, I'm not for or against using a set of functions instead of a
class. And the transients API is great the way it is. If there's no
difference in performance, I personally don't care either way. However, I
am for consistency and don't see a reason why we should use both techniques.

And what about static class variables rather than global variables? WP
stopped supporting PHP4 last year, so is there any reason not to use static
class variables for new development?

Maybe there's a wiki article I'm missing about this stuff? I did look at
the WordPress Coding Standards wiki page (
http://codex.wordpress.org/WordPress_Coding_Standards), but no luck.


More information about the wp-hackers mailing list