Curly Braces in Codes

Method 1

When I first started learning programming a few years ago, the curly braces style that i have always used was the “Allman Style”

The "Allman Style" puts the brace associated with a control statement on the next line.

“Proponents of this style often cite its use by ANSI and in other standards as justification for its adoption.”

Method 2

Lately the style in vogue in almost all major PHP projects is the “One True Brace Style”

The "One True Brace Style" puts the brace on the same line. 

If you asked me, i still like the Allman style as it is more readable, but when such when large projects such as Drupal and WordPress (see images below) use the “One True Brace Style” it is hard not to use it.



Interesting links:


1 comment Write a comment