[wp-hackers] corrected > coding standards and practicality of use.

scribu scribu at gmail.com
Sat Mar 10 20:07:57 UTC 2012


On Sat, Mar 10, 2012 at 8:57 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> would you implement the whole thing based on class/object/methods or
> would you go for the good old functions route?
>

Unhelpfully, the answer is: it depends.

Take the taxonomy API, for instance: most functions take two parameters: a
term id and a taxonomy, so you end up passing the taxonomy repeatedly:

echo get_term_link( get_term_by( 'slug', 'some-term', 'some-taxonomy' ),
'some-taxonomy' );

It would be easier to use if there was a WP_Term class that contained a
get_link() method instead.

On the other hand, there are a lot of cases where a plain function will
work just fine.

>
> and as to "the needle or the haystack first", which argument order
> makes more sense to you?
>

It's arbitrary. I think the most important thing is to be consistent within
your library.

-- 
http://scribu.net


More information about the wp-hackers mailing list