Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 6
    Exactly. Stepping through your program with a debugger should, in general, not be necessary to understand your own code - if it is, your code is spaghetti and should be shot (read: uses insufficient abstractions!). Of course you still must do this if something's gone wrong! Commented Nov 3, 2019 at 18:12
  • 2
    "You should just not use the debugger to understand code, it should be understandable and correct by writing it that way". This is wishful thinking - did you ever try to find a bug in other people's code? Commented Nov 4, 2019 at 13:56
  • 1
    This isn't anything particular to embedded computing. Lots of devs just write code for all types of things and "test" it by trying it to see if it works. Success is gauged not by the lack of bugs, but at least simply by them not manifesting during the "test". Commented Nov 4, 2019 at 18:21
  • 1
    @LightnessRaceswithMonica: arguably "something has gone wrong" is synonymous with "you don't understand your code". At least, it didn't have the effect you expected, and so there's something you don't understand. The only thing worse than it being that I don't understand my own code, is if I do understand my own code and the problem is a compiler/hardware bug... So yeah, if I start out not understanding my own code by default, then something has gone badly wrong. Commented Nov 4, 2019 at 23:44
  • 2
    @Trantor You're missing the point. This obviously does not apply to code that is already written and must be dealt with, it applies to active development. Getting things right at a higher level of abstraction prevents errors from cascading and multiplying. Designing code well and then executing on that design will always give a better result that writing any old crap with no idea of whether it will work, and hoping you can catch all the issues with a debugger. Commented Nov 5, 2019 at 0:03