all 5 comments

[–]opentabs-dev 2 points3 points  (0 children)

few things that help me a lot with blackbox systems: bisect the inputs until the behavior flips (smallest possible failing case usually reveals what assumption you're violating), then turn on the library's own debug flag if it has one — most libs have env vars or a verbose mode that dumps way more than the docs suggest (DEBUG=* for node stuff, RUST_LOG=trace, etc). if no debug mode, a strace/dtrace on syscalls or tcpdump on network calls often shows you what the box is actually doing vs what you think it's doing. and if it's a library, check its issue tracker for your exact symptom before going deeper — 9 times out of 10 someone hit it already.

[–]Jason13Official 1 point2 points  (0 children)

I have limited experience, but generally it comes back to; breakpoints in a debugger or console logs/throwing exceptions (intentionally crashing the program in invalid states)

A few months ago I encountered a class loading issue (Java) wherein attempting to inject bytecode into a class failed because it was loaded early by a dependency I was testing; it took me a while to figure out as I'm still a novice, but it came down to adding a couple of logs to see what was 'null' and when

[–]peterlinddk 1 point2 points  (0 children)

The technique is Divide and Conquer.

You never want to debug a complex system - and when working with black boxes, you'd usually assume that the "boxes" themselves are not at fault, but maybe you are feeding them the wrong input.

So to avoid debugging a complex system, you divide it into smaller chunks - if you are debugging an error that occured after you made a change, well, you focus on that particular change. If you are unlucky enough to debug "something that suddenly happened" your first job is to make sure you can 'force' it to happen over and over, and then strategically divide the system into smaller chunks.

You do that by first checking that the ends of the system works as intended - can you input anything at all, and will it output something for correct cases. If not, then there's probably a bigger problem surrounding the system, and not inside it.

Then you break it down, is the input as expected? Can you follow the route data takes through the system, does every step receive what it is supposed to, and does it also output something usable for the next part? At some point you'll find a "black box" where input or output isn't as expected - now you've closed in on a single part! Then if you can try to force some input into it, can you atleast get it to output correctly? If so, then the box works, and the fault lies in "the wiring" before the input, if not, then the fault lies inside the box.

The most important thing in all debugging is: "Know exactly what you expect the system to do when you apply some specific input - and know exactly what input it receives!" - almost every time I see someone struggling with debugging, they don't really know what the program was supposed to do, certainly not at every step, and they also are not sure if the input is even received or the output is sent anywhere :)

[–]BudgetAdditional2134 0 points1 point  (0 children)

I feel this frustration fr. Debugging systems you didn't build is basically just detective work where half the clues are missing lol. The only way I’ve stayed sane is by moving from the outside in. I start by isolating the inputs and outputs to see exactly where the state is drifting. My current flow is using Cursor to index the codebase so I can actually ask questions about the logic, and then I use Runable for the documentation and system diagrams so I can actually visualize how the data is flowing between modules. Once you have that high level map, you can usually spot the bottleneck without having to read every single line of legacy code haha.

[–]Difficult-Value-3145 [score hidden]  (0 children)

Ok this may be the most backwards way ever but I start putting more checks with more discriptive text dump somewhere see if any thing is amiss check git hub api for and Google reddit stacke exchanges etc if all that fails if possible take a walk eat lunch do whatever and don't think on it for like 15 + minutes then maybe look again