My own set of Coding Standards and Guidelines

I start seeing a lot of code lately, and I was in the position that I had to judge it. This experience triggered me in writing this article because it seems that not so many people are applying a set of rules when coding. This set of Coding Standards and guidelines in some cases is not related to the language in which we are working but there are also specific “rules” for specific languages.

I will start just to point out some guidelines (these are not the only ones or the most important)

  • I always try to write methods that are not exceeding 60 lines of code
  • Name the variables/methods/classes as meaningful as possible
  • Try to use as much as possible STL instead of custom containers
  • Allocate on stack as much as possible
  • When in need of a pointer try to use a smart one (preferably unique_ptr)
  • When creating an interface, the usability is my primary target.
  • Try to respect SOLID and OOP principles
  • Focus on readability, if a commentary is needed is not the best option
  • Do not use interleaved conditions or loops
  • A method should not have more than one loop/condition

It is not hard to write clean code, is always time and pressure that makes us forget about quality and focus on results. Of course, everything should be delivered in a reasonable time, but this is not an excuse to write hard to read, hard to maintain code. If you work somewhere where quality is not important, maybe you are not in the right place.

What are your Coding Standards and Guidelines ? What you consider to be important when writing code?

You can follow and like us:

Author: Horațiu Condrea

My name is Horațiu Condrea, and I work as a Software Developer Manager at Siemens PLM Software. I hope that my experiments will prove to be useful for many of you guys/girls out there. Don’t forget to leave a comment whenever you run over a bug or something that is not working as it should be. For any kind of information contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.