CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

View Poll Results: Were you taught how to debug code at college/university?

Voters
39. You may not vote on this poll
  • What's debugging?

    1 2.56%
  • No.

    17 43.59%
  • Some help was given.

    9 23.08%
  • Yes, it was part of the course.

    0 0%
  • Not applicable, self taught programmer

    12 30.77%
Page 3 of 5 FirstFirst 12345 LastLast
Results 31 to 45 of 64
  1. #31
    Join Date
    May 2009
    Posts
    2,413

    Re: Were you taught debugging

    Quote Originally Posted by Arjay View Post
    I have a preferred list of debugging techiques. From most preferred to least preferred:

    Debugger
    Log File
    Event log
    Trace output
    Message box

    Blindly trying things hoping it will work is the worse.
    This list is pure nonsense.

    For example why is a debugger better than the rest?
    Last edited by nuzzle; September 14th, 2009 at 06:53 PM.

  2. #32
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Were you taught debugging

    Quote Originally Posted by nuzzle View Post
    This list is pure nonsense.

    For example why is a debugger better than the rest?
    Chill out, baby - I wrote that it's my preferred list. If you get better mileage out of some other technique(s), good for you.

    For me, I can pinpoint a problem faster in a debugger than using any other technique.

  3. #33
    Join Date
    May 2009
    Posts
    2,413

    Re: Were you taught debugging

    Quote Originally Posted by Arjay View Post
    For me, I can pinpoint a problem faster in a debugger than using any other technique.
    Sure you can but you're not always available, are you?

  4. #34
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Were you taught debugging

    Quote Originally Posted by nuzzle View Post
    Sure you can but you're not always available, are you?
    I can be. Send me a pm and we can discuss rates.

  5. #35
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Were you taught debugging

    Quote Originally Posted by nuzzle View Post
    I'm not saying you shouldn't use a debugger. I'm saying you should strive for having not to use one.
    I suppose my increased usage of STL and Boost are following this philosophy as well. I'm a big fan of the "if it compiles it's probably right, and if it's not it'll throw an exception" style of coding.

    Asserts being part of that category, since even though they're not *really* exceptions they behave the same in gdb---they halt execution at the point of failure for you.

  6. #36
    Join Date
    May 2009
    Posts
    2,413

    Re: Were you taught debugging

    Quote Originally Posted by Lindley View Post
    I suppose my increased usage of STL and Boost are following this philosophy as well. I'm a big fan of the "if it compiles it's probably right, and if it's not it'll throw an exception" style of coding.
    What I suggested was to not introduce any bugs in the first place. Then you don't need a debugger, do you?

    Not to introduce any bugs (that needs debugging) you use a proper program development method, like for example Stepwise Refinement.
    Last edited by nuzzle; September 14th, 2009 at 07:54 PM.

  7. #37
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Were you taught debugging

    Quote Originally Posted by nuzzle View Post
    What I suggested was to not introduce any bugs in the first place. Then you don't need a debugger, do you?
    Good in theory, impossible in practice.

    Not to introduce any bugs (that needs debugging) you use a proper program development method, like for example Stepwise Refinement.
    Such things help. However, they can't prevent all bugs, so as I said before: Debugging is a multi-approach discipline.

  8. #38
    Join Date
    May 2009
    Posts
    2,413

    Re: Were you taught debugging

    Quote Originally Posted by Lindley View Post
    Good in theory, impossible in practice.
    You're wrong. Stepwise Refinement is always practible.

  9. #39
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Were you taught debugging

    I didn't say anything about your pet method. I said it's impossible to avoid bugs entirely all the time. But you'd know that if you bothered to pay attention to which part I quoted.

  10. #40
    Join Date
    May 2009
    Posts
    2,413

    Re: Were you taught debugging

    Quote Originally Posted by Lindley View Post
    I didn't say anything about your pet method. I said it's impossible to avoid bugs entirely all the time. But you'd know that if you bothered to pay attention to which part I quoted.
    It's not my pet method. In fact Stepwise Refinement is the mother of all program development metods.

    Note that a debugger doesn't help you avoid bugs.

  11. #41
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Were you taught debugging

    Quote Originally Posted by nuzzle View Post
    Note that a debugger doesn't help you avoid bugs.
    Of course not. It helps you solve them. That's why it's called a "debugger".

  12. #42
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Were you taught debugging

    The debugging tools I use are all dependent on the nature of the bug I'm trying to find.

    I find that algorithmic bugs are often easier to solve using the debugger; I can see the variables change, modify them if necessary and step into functions to see where execution differs from that I expected.
    In simple cases I may just bring up a dialog box with the values of interest.

    Other problems can sometimes be intermittent; Our applications are realtime, multi-threaded and asynchronous. The debugger is usually useless in this case for tracking down non-complient behaviour. In this case I resort to our event log. Our event logging system allows us to enable/disable logs through an external file, so event log code tends to stay in the source. The overhead of testing for an enabled/disabled log has been designed to be extremely low.

    As a general rule in building the code, I tend to write in a functionally modular style; Each area of functionality is as self contained as possible and as near as possible, testable in isolation. Any functionality that can be identified as part of a more general case will often be written in a generic fashion and added to our library, often customised by the use of polymorphism or dependency injection. This allows a resource of tested and debugged code to be used with confidence in new applications.

    At the lowest level, exceptional errors, such as out of bounds or illegal parameters, are trapped using exceptions which log the class, function and reason. These can be switched off using a compiler switch when necessary for performance critical code.

    In fact Stepwise Refinement is the mother of all program development metods.
    I think that modular construction is a necessary addition to that, otherwise software can grow into a large unmaintainable monster, even though it may be functionally correct.
    Our old library contains an image class that started simple. Stepwise development saw it increase in functionality over the years. Unfortunately it started to become a massive class that contained every 'useful' function that various coders came up with. Our new library now splits the responsibility in STL fashion i.e. container/iterator/algorithm. Now stepwise development involves merely devising an algorithm that conforms to the iterator interface.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  13. #43
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Were you taught debugging

    I mostly find debugging the program very difficult when using library(.lib) or dll.

    What is your opinion ?
    Thanks for your help.

  14. #44
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Were you taught debugging

    Quote Originally Posted by JohnW@Wessex View Post
    Our event logging system allows us to enable/disable logs through an external file, so event log code tends to stay in the source. The overhead of testing for an enabled/disabled log has been designed to be extremely low.
    When I use logging, I prefer a logging mechanism that is capable of different log levels and has indenting. With this logging framework, I generally log when I enter and leave method (usually logging additional info in these calls as well). I just find it easier to read the log file that clearly shows where you've entered and exited methods as opposed to a left-aligned log.

  15. #45
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Were you taught debugging

    Quote Originally Posted by Peter_APIIT View Post
    I mostly find debugging the program very difficult when using library(.lib) or dll.

    What is your opinion ?
    With Visual C++ debugging a DLL or .lib is no different than debugging an exe.

Page 3 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured