Docstoc

Programming Tips

Document Sample
Programming Tips Powered By Docstoc
					Programming Tips
(1) Avoid using the same variable again and again for different purposes. This happens with us that we think that more and more memory will be wasted if we declare seperate variable for each purpose. But, if any debugging is about to be done and program is quite a typical. Then, debugger will get confused and Dry-Run will also not work in such a scenario. So, if your program is small then, you can use the same variable. But, if it is complex, then do not use the same cheap practive. (2) Use capital letter to variable name for global variables. You should use capital letters because, there should be distinguishable difference between a local variable and global variable. There should not be any confusion while dry run or debugging. (3) All the variables should be declared at one place. This helps the programmer to analyze whether some variable is yet declared or not. If we declare them at different locations, then, a proper manner can not be acheived in your programming. The variables should normally defined just below the function declaration. (4) There should be proper indenting in whole program. Indenting helps you understand the program and the logic behind the statements well. This is cheap practice to write the functions, iterations and conditional statements without indenting. It looks like a junk also. There should be a proper demarkation in your mind and the same concept should be followed in all the portions of your program. (5) Commenting. Commenting is very much important. Although, there is no relation of them from your logic and programming. But, once you debug your program or new amendments are done, it becomes tedious to understand the logic behind that coding section. That is why, commenting is very neccesary in programming.

(6) Do not use labels. In some programming languages like BASIC, there is scope of providing labels. Experts say that using such labels produces extra burden in the operating system. So, you should avoid them. (7) Do not declare unused functions or variables. This practice is also prohibited. You should not declare such a variable which is not getting used anyewhere. You should check it out when you are going through dry-run also. (8) Coupling should be avoided cohesion should be increased. Coupling comes to picture when the output of a function is input to other. This produces a sort of ripple effect and debugging becomes a problem and errorprone programming is found in such state. (9) Always write the program or check the logic then, come to type. This is a general practice that people directly sit on system and try to build logic and all the necessary corrections are done. But, such anactivity may produce problems like unused variable (regular declaration and descarding) , unused functions (declare and forget to call or just checking), moving in the wrong direction of logic. So, you should decide things before you come to portray them. (10) Do not learn programs, try to develop your own logic. Each person has logic but, there should be flow in that logic. If flow is absent then your ideas can not reach the destination. So, instead of learning an old algorithm, try to your own program based on your logic. Article Source: Ezine Articles

For more info on Programming and Software Development please visit A-1 Technology


				
DOCUMENT INFO
Description: Avoid using the same variable again and again for different purposes. Use capital letter to variable name for global variables. All the variables should be declared at one place. There should be proper indenting in whole program.