go away spammer

Author Topic: debugging programming - plz help  (Read 3551 times)

0 Members and 1 Guest are viewing this topic.

Offline frodoTopic starter

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
debugging programming - plz help
« on: December 28, 2008, 06:44:25 AM »
what does debugging programming mean and how do you do it?
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline Thomas Countz

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Re: debugging programming - plz help
« Reply #1 on: December 28, 2008, 01:52:04 PM »
Debugging is simply the process of removing any unwanted behavior (bugs) from computer hardware or software, therefore allowing if to behave as planned. If your hardware or software is behaving as expected, it is said to contain no bugs. However, if your hardware or software is doing something unplanned or unexpected, it is said to have bugs, and thus, needs "debugging."

Debugging is simply another word for "fixing" your hardware or software and removing it's flaws.

Offline frodoTopic starter

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: debugging programming - plz help
« Reply #2 on: December 28, 2008, 02:04:45 PM »
if need be, how would you debug a program?
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline Thomas Countz

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Re: debugging programming - plz help
« Reply #3 on: December 28, 2008, 02:12:32 PM »
if need be, how would you debug a program?

Well before you debug, there needs to be a problem, lets say, your IR sensor is giving inconceivable data. Well with that problem, you know you have to check your code that reads and writes data coming from your IR sensor. So to debug you have to look at the trouble part of your code and find an error. By using tools such as UART and HyperTerminal, you can directly read the output of your sensor, allowing you to spot problems. If you can't find it in your code, check your hardware. By using an oscilloscope, you can find hardware problems.

Sorry if that example confused you....  :o ??? 

Debugging is simply fixing problems...if there's a problem, fix it...how?
  • Isolate the area of defect
  • Search for any error
  • Fix the error
  • YOU HAVE JUST DEBUGGED!

If your asking about "debuggers" then they are programs that allow programmers to check their code while simultaneously running it.

This Wikipedia article might help?
« Last Edit: December 28, 2008, 02:15:57 PM by Thomas Countz »

Offline cosminprund

  • Robot Overlord
  • ****
  • Posts: 284
  • Helpful? 8
Re: debugging programming - plz help
« Reply #4 on: December 29, 2008, 05:42:16 AM »
if need be, how would you debug a program?

Unfortunately there's no predefined algorithm for debugging. Some times you're lucky and you'll see the error right away and fix it, some times it will take much longer. There are no shortcuts here and no way to "learn" this: you'll need to write code, make mistakes, fix your mistakes and learn from the way you fixed your mistakes. In other words it's all about experience!

But don't worry about this, you'll learn this as you go.

Offline Dscrimager

  • Full Member
  • ***
  • Posts: 57
  • Helpful? 0
Re: debugging programming - plz help
« Reply #5 on: December 29, 2008, 12:42:39 PM »
Well there may not be an algorithm but there are some ideas to keep in mind:

- perturb the system and see how it reacts, i.e. make one small change (see next principle) that should produce a different output and see if it does

- only change one parameter/setting/etc at a time and see if it makes a difference, be systematic and track all changes

- try doing the simplest thing and keep that as a baseline, e.g. if you are trying to get something to work that will have changing settings/configurations, get a basic working version with 1 set of values that you can always test with when the more complex version is not working as expected

- always double check connections and soldering

- try and examine your assumptions and see if they hold. I recently found a compiler limitation with global variable names. I found it by proving that the global name being set in the subroutine wasn't keeping it's value outside of the subroutine even though that should be impossible and no errors/warnings were thrown. I changed the name of the variable ( perturbed the system) to a unique name that was shorter and it suddenly worked.

- undo your last change if it broke something and check to be sure you are back to the working situation, keep unwinding until you find the fault

- always keep backup versions of your working software, preferably with source code control

-RTFM, yes, RTFM if you don't know what this means look it up

- google, google, google

- learn to read and understand assembly code, as one of the few people who can utilize assembly on the various development teams that I have been on I have an extra tool in my toolbox that other developers with high level language expertise only cannot effectively apply. Don't need it often, but when you need it your REALLY need it.

These are all principles that help me almost every day in figuring things out

I'm sure that others can chime in with some good ones as well.
Doug

Offline frodoTopic starter

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: debugging programming - plz help
« Reply #6 on: December 30, 2008, 02:01:52 AM »
thanks
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: debugging programming - plz help
« Reply #7 on: January 09, 2009, 10:33:43 PM »
Quote
If your hardware or software is behaving as expected, it is said to contain no bugs.
nah, it just means no bugs were found :P


You should also consider bug prevention:
less code = less to debug

Keep your code short, simple, clean, and avoid "feature creep" like the plague.

Also, use functions so you can isolate different parts of your code. That way you can verify chunks of code as 'bug-less'.

Offline frodoTopic starter

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: debugging programming - plz help
« Reply #8 on: January 10, 2009, 09:41:32 AM »
i'm quite new to programming so i have no idea what that is supposed to mean, admin, but thanks anyway
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

 


Get Your Ad Here