Importance of Coding style
"Code is read more than it is written". An individual block of code takes moments to write, minutes
or hours to debug, and can last forever without being touched again. It’s when you or someone else
visits code written yesterday or ten years ago that having code written in a clear, consistent style
becomes extremely useful.
The finished code should look like it has been finished by single developer and in a single session.
Certain Guidelines:
or hours to debug, and can last forever without being touched again. It’s when you or someone else
visits code written yesterday or ten years ago that having code written in a clear, consistent style
becomes extremely useful.
The finished code should look like it has been finished by single developer and in a single session.
Certain Guidelines:
- There should be consistency in the naming convention of the variables throughout the code. Also, the data should be described that is there in the code
- The code should be such that one should be able to understand it even after returning to it after some time gap, without that person having to look at every line of it
- When you see a variable called, balance_sheet_decrease , it’s much easier to interpret in your mind than an abbreviated variable, like bsd or bal_s_d . These types of shortcuts may save a few seconds of typing, but hours can take to tackle with the technical defect so it is not worth it. "Avoid abbreviating variable names."
- Refactor repeated lines of code into reusable functions or methods.
- "comment your codes"
Comments
Post a Comment