I am writing a coding standards document for a team of about 15 developers with a project load of 10 to 15 projects per year. Among the other sections (which I can post here when I get to them), I am writing a section on code formatting. So for starters, I think it's reasonable that for some reason we set some basic, consistent code formatting / notation standards.
I looked at about 10 projects written over the past 3 years from this team, and I obviously find a fairly wide range of styles. Contractors come and go, and sometimes even double the size of the team.
I am looking for some suggestions for code formatting and naming standards that have really paid off ... but it can also be really justified. I think that consistency and common patterns are of great importance for providing more convenient code maintenance ... but are there other things that I should consider when defining the specified standards?
How do you group parentheses? Do you follow the same brackets when working with classes, methods, try catch block, switch statements, if else blocks, etc.
Are you aligning fields in a column? Do you mark / prefix private variables with underscores? Do you follow any naming conventions to make it easier to find information in a file? How do you order your class members?
What about suggestions for namespaces, packaging, or organization source codes / standards? I start with something like:
<com|org|...>.<company>.<app>.<layer>.<function>.ClassName
I am curious to find out if there are other, more acceptable, practices than what I'm used to - before I dare to dictate these standards. References to standards already published on the Internet will also be good - although I have already done this a bit.
source
share