[wp-hackers] prefix vs postfix - pros and cons
Chris Taylor - stillbreathing.co.uk
mrwiblog at gmail.com
Wed Feb 22 20:33:12 UTC 2012
I assume this is for use within a WordPress system, yes? In which case
be aware that BuddyPress uses a bp_* convention for many of its
internal methods. Therefore your *_bp convention would be better.
On Wed, Feb 22, 2012 at 6:55 PM, Haluk Karamete <halukkaramete at gmail.com> wrote:
> when building a framework of library functions, and you need to make
> sure your function and variable/constant names will not get mixed up
> by people's custom code, which way would you go? prefix your
> functions?, or postfix them?
> I'm building a library of php functions ( expected to be around 200
> functions or so ) to ease my day to day operations and I need to adopt
> a style.
> I would like to pick your brains. My library will be called blueprint,
> so the prefix/postfix would be either bp_ or _bp. Which one is better?
> example leftof functiond, takes a string and returns the leftof what's
> passed as substring.
> so, ahuold this leftof functions be preifxed as
> or postfixed as
> it appears to me that the latter is more effective because of two reasons
> one is intellisense... the moment you type in "ins" for insert, you
> get your dropdown instantly. In the prefix approach, the first 3 chars
> gets me no where.
> secondly, when think of an action, you think of it directly, insert a
> record, or list records, etc. So, you'd instinctively go for typing
> that action such as insert_record, rather than
> The only advantage I see in prefixing is that in a functions list (
> where your frameworks' functions mixed up with other frameworks), you
> can see that your library of functions are all lumped together when
> sorted alphabetically. But practically speaking, I don't see much
> benefit to that.
> When it comes to file naming convetions, I'd go for prefix though. But
> it has its own dynamics, in file operations, alphabetical sorting is
> My question is on specifically function and variable names which are
> typed/thought a lot.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers