After you have programmed for a while, you start to recognize good code from bad code. One of the things that makes code better is making it consistent.
Code consistency leads to code that is:
- easier to read
- easier to debug
- less buggy
- easier to code review
- easier to maintain
Ultimately, having agreed upon consistency in our code allows us to focus more on what we are building, and less on how to write it. This in turn, let’s us deliver better features, faster.
Here is our style guide for rails. This has come from lessons learned on building our own app, looking at lots of external code, plus checking out other peoples’ style guides.
Bonus points to anyone willing to write a rstyle tool (something like cstyle) to automate the task of ensuring code consistency.