際際滷

際際滷Share a Scribd company logo
To write code, like a boss
Tab key is your friend
Indentation increases the readability of your code.
Its quick to understand the beginning and end of
loops, while revisiting the lines, if your code is
properly indented.
use _ (underscore) to make
long variables names more readable
The variables are the blood veins for your code.
Do not take names of your variables for-granted,
they should clearly express their role, wherever and
whenever used.
user_generated_last_yield()
is better than u_g_l_y()
Abbreviations create confusions. DO NOT use
abbreviations for your method/function or variable
names. Its better to write
Dont call it a function if it has
hundreds of lines of code
Functions and methods are meant to make your code
modular, do not write lump of lines it and make it
complex.
Dont let your variables
survive like orphans
Always assign a default value to your variables and
function arguments. A value less variable is always more
dangerous than you think.
Sometimes a single clue or a hint
can solve a huge puzzle in seconds
Comments help you when you are lost.
When you write a code of thousand lines, its difficult to
recall the strategy when you go back to line 1.
Destroy/flush the variables
when you are done with them, to reuse
Yes they dont cost you, but it doesnt mean you can use
hundreds of them together in a single scope.
Too many variables create a mess.
You should be able to understand
It, just while going through it
Use a good code-editor, apply proper line breaks, avoid
un-necessary whitespace as they will increase the scroll
length.
Simple code is always simple to code
Compiled by:
AVIL PORWAL
avilporwal@gmail.com
facebook.com/avilporwal
behance.com/avilporwal
google.com/+avilporwal
linkedin.com/ in/avilporwal
Skype: avilporwal
Twitter: @avilporwal
Lets be friends :)
Best coding practices to follow - to write a code, like a boss

More Related Content

Best coding practices to follow - to write a code, like a boss

  • 1. To write code, like a boss
  • 2. Tab key is your friend Indentation increases the readability of your code. Its quick to understand the beginning and end of loops, while revisiting the lines, if your code is properly indented.
  • 3. use _ (underscore) to make long variables names more readable The variables are the blood veins for your code. Do not take names of your variables for-granted, they should clearly express their role, wherever and whenever used.
  • 4. user_generated_last_yield() is better than u_g_l_y() Abbreviations create confusions. DO NOT use abbreviations for your method/function or variable names. Its better to write
  • 5. Dont call it a function if it has hundreds of lines of code Functions and methods are meant to make your code modular, do not write lump of lines it and make it complex.
  • 6. Dont let your variables survive like orphans Always assign a default value to your variables and function arguments. A value less variable is always more dangerous than you think.
  • 7. Sometimes a single clue or a hint can solve a huge puzzle in seconds Comments help you when you are lost. When you write a code of thousand lines, its difficult to recall the strategy when you go back to line 1.
  • 8. Destroy/flush the variables when you are done with them, to reuse Yes they dont cost you, but it doesnt mean you can use hundreds of them together in a single scope. Too many variables create a mess.
  • 9. You should be able to understand It, just while going through it Use a good code-editor, apply proper line breaks, avoid un-necessary whitespace as they will increase the scroll length.
  • 10. Simple code is always simple to code