3 ms·
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
- _random_ 13y agoYou don't have to follow guidelines if you are using a modern IDE. Guidelines should follow your code. VS 2012 + ReSharper.
- nkuttler 13y agoOh, 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.
- cLeEOGPw 13y agoGNU for C/C++
- chewxy 13y agoPEP 8 for Python, Go fmt all the things
- etioyuahgdhjdkg 13y agoSpaces. Not tabs. No exceptions.
- _random_ 13y ago> No exceptions try { ... } catch {} Seems a bit radical, but hey, who am I to argue.
- agoandanon 13y agoK&R braces in all things. Because that is the One True Way to do it.