d11wtq wrote:
How many people follow a strict style, whether it be taught or personal preference?
What do you find help make code as readable as possible?
I follow a fairly strict style. After seeing the phpbb coding guidelines, I grabbed a copy, modified it to match my preferences, and posted my version for my projects (
http://www.kabal-invasion.com/guidelines.html)
I've generally followed those guidelines for the last 18 months or so in most of my projects. For me, the critical top three:
- Works with reg_globals off, and notices on
- Brackets line up
- NO TABS
Almost all of it is related to my coding preferences. I end up going back and forth between webcvs views and putty w/ nano all the time. As a result, tabs aren't pasted correctly, and I end up with massive diffs for no changes. I hate tabs as a result.
Not to mention, using nano as my editor, having the brackets line up really makes it simple to scroll to the spot I need to.
Of course, most of my projects start with "someone else"'s code, and then i spend years modifying it to match my preferences. That means I end up with plenty of procedural code where I would normally use OOP, and plenty of code that breaks my guidelines.
All told, it definitely helps (me) to document the style, so I can refer to it, and so that other developers on the project can too.