Hello Developer’s, howz your coding life going on?? here is a short article for you, I know that it will be very frustrating to read this full article but Dude keep patience and read it, this article will really help you.
Do you remember the last time when you fixed a small but trivial bug in your system, if you did then just try to remember how did you found the cause of the bugs ?????, which category the cause belongs to ??? (was it a functional error, typo error, coding error, null reference error or caching error), now how did you fixed the bug what steps you took to fix the bugs?????????.
Truly speaking my experience, sometimes I got a bug in the system and searching the cause of the bug took more time than fixing the bug, because bug was simple typo/coding/null reference error. So guys be careful, these typo/syntactical/null reference errors….etc. category of bugs becomes more trivial and it takes a lot of time of developer. So now we should have some salutary lessons from our last small trivial bug, so that in future these issue will never come.
Congratulations!!!! You are one of the few who realize that over 80% of errors are simple and easy to fix. It is important to realize this as it can save a lot of time. Time that could be wasted making unnecessary changes, that in turn can cause further problems.
Programming is a humbling experience. An experience that causes one to reflect on human error. One major cause of these errors is syntax, syntax, syntax. We tend not to notice when we have made a typo. It is too easy to spend an hour trying to fix a problem that was caused by a typo. Accepting human error, that you made a mistake, is a reasonable first assumption.
Another important assumption to fixing problems is Occam's razor - the simplest explanation is more often than not the best. When we initially expect a simple error we don't try to over complicate things and we are more likely to use basic techniques to trap the error; we use simple debugging procedures.
Sometimes just writing a message is enough to see what is going on. One easy technique is to trap the error in a try catch block and write the error message. Its surprising how often this simple technique is not used.
In asp.net there is a custom errors mode remote only. What this does is display the exception only on the local server, but anywhere else. Other users of your application may be directed to a customized error page, while you figure out what's going on.
A very important step to avoiding errors in your application is testing. This is best done on a separate machine to the development and production servers. Even if you don't have access to a test environment this is no reason not to test. We developers are not the best testers -:) . Get someone else or preferably a group to test, believe me you'll save time and probably money.
One of the most common errors is the 'object reference not set to an instance of an object'. Null reference errors are common too. Something, a reference or a parameter for example, is missing. So check the page references and parameters. Look in that error line to see what may be missing or null. Write any values that may be null.
A simple thing that you can do is continue to practice. Programming in an unfamiliar language is slow to start with, but experience is cumulative. As you get more practice, things like error handling become easier. It doesn't become easier if you just copy & paste all the time, there is no substitute for understanding what's going on.
There are many debugging techniques, but that is not the point of this article. Its not until I started to appreciate the number of my errors and the simplicity of fixing them, that I really started to make progress. At times I am still guilty of skipping the diagnosis and heading straight for the medicine cupboard. This has almost always been a mistake.
I hope that you avoid some of the frustrations that I have had over the years by not ignoring human error and accepting how simple steps can resolve most problems.
Happy Coding! Enjoy Coding!!!!!!!!!
Excellent article dude !
ReplyDelete