News for hackers. Stuff that matters.

Ask HN: Which coding guidelines do you use?

Always interesting to see what code guidelines people use in what language.

Personally, I use the following for PHP: Basic Coding Standard: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md

Coding Style Guide: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

( 7 comments | 4 points | on HN )
Re:Ask HN: Which coding guidelines do you use? by nkuttler on Wednesday August 07, 2013 @03:47AM (#6171406)
Oh, it's a question about PHP... Anyway, I either use the one that's official for the language, the one that applies to the project I'm just working on, or the one that seems the most sensible to me. For the latter I normally check a few very popular projects for the language and see what they agree on.
Re:Ask HN: Which coding guidelines do you use? by _random_ on Wednesday August 14, 2013 @04:08PM (#6213891)
You don't have to follow guidelines if you are using a modern IDE. Guidelines should follow your code. VS 2012 + ReSharper.
Re:Ask HN: Which coding guidelines do you use? by agoandanon on Thursday August 08, 2013 @12:14PM (#6179858)
K&R braces in all things. Because that is the One True Way to do it.
Re:Ask HN: Which coding guidelines do you use? by chewxy on Wednesday August 07, 2013 @08:52AM (#6172409)
PEP 8 for Python,

Go fmt all the things

Re:Ask HN: Which coding guidelines do you use? by etioyuahgdhjdkg on Wednesday August 07, 2013 @10:01AM (#6172840)
Spaces. Not tabs. No exceptions.
Re:Ask HN: Which coding guidelines do you use? by _random_ on Wednesday August 14, 2013 @04:06PM (#6213881)
> No exceptions

try { ... } catch {}

Seems a bit radical, but hey, who am I to argue.

Re:Ask HN: Which coding guidelines do you use? by cLeEOGPw on Wednesday August 07, 2013 @08:22AM (#6172273)
GNU for C/C++