Ask HN: Which coding guidelines do you use?
6 comments
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.
You don't have to follow guidelines if you are using a modern IDE. Guidelines should follow your code. VS 2012 + ReSharper.
K&R braces in all things. Because that is the One True Way to do it.
PEP 8 for Python,
Go fmt all the things
Go fmt all the things
Spaces. Not tabs. No exceptions.
> No exceptions
try { ... } catch {}
Seems a bit radical, but hey, who am I to argue.
try { ... } catch {}
Seems a bit radical, but hey, who am I to argue.
GNU for C/C++
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