I want some questions to be answered by our fellow developers regaurding coding standards.
- Is it true a developer is judged by his coding standard?
- What are the best practices of coding standards which could be followed in a web application?
- What are the common coding standards that budding developers fail to adapt in their application?
In my first year of work, at a large and well respected company with brilliant engineers, I got yelled at by an architect for writing
if(foo)instead ofif (foo)— I asked him to explain, and he said “IF is not a function. Don’t do that.”I’m glad that you’re thinking about this stuff. Coding “standards” means different things depending on where you are– there’s everything from straight-up “style” (where you put your curly braces) to patterns (this sort of thing should be a singleton, this sort of thing should be produced by a factory object) to guidance specific to the stuff you’re working on (“Here in this office, we always use such and such a package to validate and sanitize web parameters, so you should use that.”).
In general, the answer that you’ll hear from most people is “be consistent with other people already working on your codebase”. If they’re already not being consistent, then step up and make the rules yourself based on your instincts. If you’re a real rookie, don’t worry about it– we all have been– ask other to review your code as your commit it, and you’ll often find you learn a ton about how experienced developers think.