Posted on: August 02, 2011 11:32:18 AM
Some of my friends and students face many errors while programming. And they waste most of their time in detecting those errors.
But actually, avoiding those errors completely is better than detecting and solving them. So I decided to write an article about avoiding those errors. I added here some coding practices of my own and others are summarized after some amount of googling on Internet!
- Be consistent about formatting and naming conversions.
- Variable and method names should be more descriptive.
- List your common errors and check for them each time.
- Write out the structure of your programming block first. For instance, instead of writing if(a>b){ print("Hello World")}, you write if(){} then you write if(a>b){} then you write if(a>b){ print();} then you write if(a>b){ print("");} then you write if(a>b){ print("Hello World")}. This will prevent syntax errors. The concept can be similarly applied for classes, functions, and other control statements.
- Write the whole thing out on paper. Yep. Sit outside somewhere and write everything.
- Always use comments for understanding things easily.
- Do not use complex calculations in a single statement.
- Code it alone, but have everyone’s reviews after you write the code, may be your output is correct, but your code may not be correct for optimization reasons.
And as everyone knows, no one can avoid 100% of their errors, but we should try our best to avoid them, in spite of detecting and solving them. I hope this article be useful to all the readers.
Article by: JigneshManek


Comments
Rucha says:
Posted on: August 02, 2011 11:40:28 AM
helpful tip for beginners :) thanks
Sagar Ganatra says:
Posted on: August 02, 2011 10:35:17 PM
bhai bhai sachi vat che atlu kare to programe error ave j this is just configuration before creating the program in any language good thought
Chirag Parekh says:
Posted on: August 02, 2011 11:31:45 PM
Great tips.........
Darshan Ganatra says:
Posted on: August 05, 2011 03:30:48 AM
Nice One Brother.......It will be helpful to everyone....