[wp-hackers] Coding style

Robert Deaton false.hopes at gmail.com
Mon Jul 3 21:59:31 GMT 2006


On 7/3/06, Brian Layman <Brian at thecodecave.com> wrote:
> I know you weren't asking for debate, but I HATE this rule!!!  I prefer a
> quick two spaces to PEAR's four, but any number of spaces less than 8 would
> be infinitely preferable to the use of Tabs, which are handled
> inconsistently between many Linux, Windows and PocketPC apps, not to mention
> browsers.  PEAR seems to handle development with spaces across a wide number
> of clients without difficulty.  Additionally, with TABs, once you are only
> four levels deep, in most standard Windows editors, you are already most of
> the way across the page before the code starts.  It makes any complex code
> VERY difficult to read.  I don't see why WP requirements should be any
> different than PEAR's in this area.

I'm interested in knowing where you're having this issue, as I have
been using tabs over spaces for everything for a number of years
without issue (granted, I don't have a PocketPC, but if I did I'm sure
I wouldn't code on it anyways). I haven't found a single application
these days that handles tabs incorrectly, and I don't see any reason
why we shouldn't use tabs.

> I know this has the whole weight of existing WP code behind it, but it vexes
> me.  Half the time I have to highlight a tab character in my
> editor-of-the-moment and put it in my clipboard so that I can put the tab
> characters in by hitting paste.
>
> That said, I think the document is a very good one that should be referenced
> from Hello Dolly.
>
> The one thing I would change is that I think this topic should specifically
> mention the convention for naming functions, variables, and constants.  PEAR
> specifies that here: http://pear.php.net/manual/en/standards.naming.php and
> it is probably one of the most important areas to cover, since all of that
> stuff is case sensitive and is easily overlooked when debugging.

functions and class names aren't case sensetive. Variables and
constants are, and the WP stance has been lowercase everwhere, I can't
think of a single variable in the WP source off hand that has an
uppercase letter in it. Constants and macros for any project should
always be uppercase, period.


-- 
--Robert Deaton


More information about the wp-hackers mailing list