Page 490 - CA_Blue( J )_Class10
P. 490

MOST COMMON MISTAKES

                           IN PROGRAMMING





                  1.  Repeating Codes: Most of the time young programmers repeat a piece of code because they are comfortable
                     with it and it is easy to use. But, this is a trap and a bad practice.
                      Solution: A programmer should always try to understand a problem and write effective codes for it.
                  2.  Naming a Variable: Variable names are very important.
                      Solution: We must take good care while naming a variable. Make sure that variable names are not ambiguous
                     and can be understood easily. We can not use any keyword as variable name.

                  3.  Complex Coding: While writing a code, one must understand that a code is essentially a solution to a problem.
                      Solution: So, a solution should be simple to understand. The core or a program is to make sure that it is easy
                     to understand and implement. There is no need to use complex concepts and write intricate functions. All you
                     need to do is write simple but effective programs.

                  4.  Proper planning: While writing a code, one must understand the concept and the problem behind it. Coding
                     without that understanding can be tedious yet unyielding.

                      Solution: So, before you start coding, try to understand the problem thoroughly and then start coding.
                  5.  Not taking a break: Coding is a tedious task. No matter how much you love to code, there is a limit to how
                     much your brain can handle a certain task.
                      Solution: Hence, always remember to take a short break while coding. Taking short breaks can help you to
                     understand a program from a different perspective.
                  6.  Syntax errors: These are  the most cause of headaches among programmers. Even the most seasoned
                     programmers can miss a comma or a semi-colon here and there.
                      Solution: Always keep an eye out while writing your codes and everything will be fine.

                  7.  Logic Errors: These are vital errors that can be very hard to spot. These errors affect the working of a program
                     and its outcome.

                      Solution: To avoid such errors, always check the working of your program and determine if there is a flaw in
                     the idea you had for the program.

                  8.  Undeclared variable: While programming we might find ourselves in situations where we might need an extra
                     variable.
                      Solution: In such cases, we might start using a variable with declaring or initializing it. So, always be aware of
                     the variables that you are using and the variables that you are going unnoticed.

                  9.  Undeclared Methods: Methods make a program versatile, at the same time they give rise to some more
                     problems. For example, people often forget to declare a method.
                      Solution: So, always provide a prototype of the method before using it to avoid this issue.
                10.  Array Bounds:  Arrays begin  indexing  at 0; they end indexing  at length-1.  For example, if  you  have a
                     ten-element  array, the first element is at position zero and the last element is at position 9.
                      Solution:  Always make sure the check the size of  the array you  are using  and  take the size according
                     to it.





                488488  Touchpad Computer Applications-X
   485   486   487   488   489   490   491   492   493   494   495