473,729 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A Simple Debugging Guide

kenobewan
4,871 Recognized Expert Specialist
Congratulations ! You are one of the few who realise that over 80% of errors are simple and easy to fix. It is important to realise 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 simpliest 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 surprizing how often this simple technique is not used.

In asp.net there is a custom errors mode remoteonly. 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 programming!
Oct 3 '08 #1
6 28871
itsraghz
127 New Member
Well, thats a beautiful write up!

You are certainly right in almost all the places. Human errors are trivial and the impacts created are more.

A fact not to forget is, "We learn by mistakes" :). But we should ensure that "mistakes are NOT repeated" -- thats when we call it as an experience!

Cheers,
Raghavan alias Saravanan M.
Nov 13 '08 #2
Rajesh V
15 New Member
Thanks for the nice article. Good encouragement for beginners like me who are afraid of bugs.
there is no substitute for understanding what's going on.
This is my most favourite line of the article.
Thank you,
Rajesh V.
Dec 25 '08 #3
freelance programmer
11 New Member
What I have found is keeping a note of what all steps you took , what all did you observe also help a lot to debug difficult bugs.
Feb 23 '09 #4
Killer42
8,435 Recognized Expert Expert
Hi.

I'd just like to point out what (ironically) looks like a typo in the article. To quote...

In asp.net there is a custom errors mode remoteonly. What this does is display the exception only on the local server, but anywhere else.
At a guess, there's a "not" missing there.
Feb 26 '09 #5
prasanxxx
2 New Member
thats so kind of you to make newbie's like me comfortable in programming.
sumtimes the problem is gruesome but at the most its due to simple things only
Apr 17 '09 #6
Bassem
344 Contributor
I was stopped for nearly three or four days in a program to count objects with specific color in an image, I did the whole code without change in approximately two hours but didn't work, after three days of just looking for what I have done wrong was a property that returns a different field's value (simply int).

It wasn't believable to me in first that I can fix a problem, It disappeared with some try and encourage thoughts like this.

Thanks, It was a nice article encourages much.
Jun 3 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1583
by: broebel | last post by:
I'm just wondering, people tell me that helping to debug someone elses program is a really good way to learn to understand the language it's programmed in. My question is: from wich point of can someone start to try to help a programmer by debugging or testing a program. If indeed you already need a profound knowledge of the language than how can you learn something about it? except for the fact that you see other
4
2249
by: Richard Shea | last post by:
Hi - I'm trying to use ZODB but I'm having trouble getting started. Can anyone point me at a very simple example ? I've had a look at 'ZODB/ZEO Programming Guide' (http://zope.org/Wikis/ZODB/FrontPage/guide/node2.html) but although it's good stuff it's not clear to me how the pieces of example fit together to produce something that works. I've also read 'Introduction to the Zope Object Database'...
0
1129
by: Jim Douglas | last post by:
I had to re-image my system today and spent too much time trying to get de-bugging working again. The system Windows XP PRO SP2, VisualStudio 2003, C#, etc, etc, clean install of everything. Where can I some type of guide, instructions, tips, anything to get this working correctly again. I have tried everything that previously worked, set debugging in IIS configuration, set debug to TRUE in the project, etc. Thanks for any help, I know...
1
1271
by: Saurabh garg | last post by:
I am getting following Problem while Debugging Asp.net application "Unable to Start Debugging Access is denied" Could anyone guide me to a useful Solution apart of the Group Membership in Debugger Users Group because I've already done that. Regards Saurabh Garg
0
3894
by: matsla | last post by:
I have followed all guide lines to set up remote debugging but is it possible to do cross-domain remote debugging? I use same account/password on both computers (XP => 2003), added users to debug group, change DCOM security etc. I get following error in the event log when try to start the remote debugging Visual Studio 2003... DCOM got error "General access denied error" from the computer COMP1
6
1281
by: Tina | last post by:
I'm a 1.1 developer learning 2.0. I have a book on 2.0 (Murachs upgraders guide)... It tells how to use the development server to test my asp.net apps ie. hit F5 just like we did in 1.1 using IIS. Then it tells all of the things you can't test using the development server and says if you want to test using IIS create a virtual directory and then just put the url into a browser and run your app.
6
4612
by: Maitre Bart | last post by:
One said: "The more time you'll spend on designing your app, the less you'll spend time debugging it." I agree with that, but chances are, you'll still need to debug it anyway! And the larger the app, the higher the chances, yours or not. There are many books that teach C++, but not so many that teach how to debug C++ apps. Like there are some "must read" for the first category, I imagine there likely to exist some "must read" too for...
1
1436
by: abhijeet28 | last post by:
Hi friends , I am facing run time error "out of memory" in my project developed on vb.net . to find error line (code) i want to use JIT debugging . I don't know how to use it in windows application, what setting have to do for it . so please guide me to use jit debugging in my windows application so that i can identify error line. thanking you
0
983
by: kwatch | last post by:
Hi all, I have released pyKook 0.0.1. http://pypi.python.org/pypi/Kook/0.0.1 http://www.kuwata-lab.com/kook/ http://www.kuwata-lab.com/kook/pykook-users-guide.html pyKook is a simple build tool similar to Make, Ant, Rake, or SCons. pyKook regards software project as cooking. Terms used in pyKook are cooking terms.
0
9280
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.