Tamara Temple wrote:
On Feb 15, 2011, at 4:17 PM, Donovan Brooke wrote:
[snip]
This is what I show my students:
http://rebel.lcc.edu/sperlt/citw229/brace-styles.php
Cheers,
tedd
I didn't know there were names for bracing styles... but
Neither did I -- just the K&R style was the only name I recognized. (I
still have a first edition!)
However, I think on my next project, I will use "Whitesmith's Style".
I would be more inclined to try other styles if my editor of choice,
TextMate, were to easily support them; as it is now, TextMate
automatically un-indents the line when you type a closing } on an open
line, and automatically indents on an open line after a opening { -- so,
what to do? I don't really want to dive into programming my editor's
functions (which I could do with TextMate) as that is really getting
into non-productive tweaking.
The issue I had at times with the K&R style was locating the the
matching (open or closed) brace.. as they were not on the same
character column.
I never really found this to be a problem as long as I kept the various
branches short enough. I was unlucky enough to find someone who coded a
function that went on for 30 pages one (this was in C, not PHP) and
*that* was hard to untangle. Of course, one of the first things I did
when I had a spare moment was to chop it up in to individual functions....
Well, in either case it add's a bit of complexity.. if you are not
searching for an end brace, you are scrolling to find a function (or
include file perhaps)... but yes, I try to keep them short as well.
One thing I do at times is comment what end brace is what..
} // end to: if $num == 6
I still can't get away from BBedit, but the only automatic thing I have
turned on is text suggestion... which I think about turning off every
time I code. ;-)
--
D Brooke
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php