DEV Community

Cover image for How to deal with errors while coding
Nikesh Kumar T K
Nikesh Kumar T K

Posted on

How to deal with errors while coding

Errors are the usual thing that occur in our journey of programming.
Beginners are the primary group who are exposed to the hesitation caused by errors.There is also a possibibility of droping programming field due to errors in beginners.But one thing we should remeber is

The skill of a programmer is not writting a bunch of code
without error,but finding the optimal solution for error
.

When we solve a particular error we can understand the core reasons for that error and avoid such
situations of error later in our code
The usual categories of error that occur are

  • syntax error -ocuurs when we violates the rules of a programming language.

  • logical error-occurs due to the improper logic in the code.
    How to deal with syntax errors

  • By using the plugins and editors that can detect syntax errors instandly.

  • Usual case of syntax errors are missing parenthesis,semicolons etc.So, make sure they are inserted properly.

How to deal with logical errors
It is difficult to detect logical errors at compile time.It can be avoided by

  • By using try-catch block for complex code for tracing the error.

  • By making a better comprehention in the logic of the code.

Use Stack Overflow for debugging

Image description
Stack Overflow is the biggest community of programmer where we can find the solutions for our errors.I usually used to copy paste my error message in stack overflow.Programmers who faced similar errors might posted their issue and there will be solutions.If no solutions found you can ask for help by mentioning your isuue with your code snippet.

Top comments (0)