Why coding style matters
19 April 2016
I was never a fan of writing comments, but when you have to written a 500 lines code without comments, you will be in a great problem when referring back to it. Also the style matters for the simple reason that anyone should be able to understand what has been written. When you work in a team of developers each one has to follow a style standard so that the code looks uniform. Otherwise the code would end up looking chaotic and unclear. Think of a code as a poem, it has to be beautiful!
Learning from my mistakes, here are basic style suggestions that can make a code look neat and easy to understand.
1. Tabs or spaces
Every language has its own style and indentation. Using them the right way is the most essential part of writing a clear code. For instance
2. Proper naming
Commenting is another major area of coding standards. Comments should be clear, short and present only where the code gets complicated. They don’t have to be every second line, but they have to be there where it gets hard to figure out what is happening. Comments are helpful for readers to understand the code. Remember that a long comment will make the code look rather messy. Keep it short and conveying.
Any fool can write a code that computers can understand. Good programmers write code that humans can understand.
Here are some good style guides that can be referred:
Originally published at surbhioberoi.com on April 19, 2016.