Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Stop trying, and just fix it.
Seriously though - methodically go through everything you can and isolate it as much as possible. Don't just guess at fixes. Write failing tests, then try to get them all passing.
If you're really stumped, then your options at that point are finding a like minded dev who can also have a go or help you out. -
beefdead2381yGoing for a walk helps. Sometimes, all you need is to detach yourself from the issue and come back to it later. :)
Also second the comment by @almondsauce. -
In practice most projects don't lend themselves to interrogation sadly, so bisection is among the most tedious and annoying debugging techniques, but by design it hardly ever fails.
-
although quite recently I had the misfortune of having to debug an issue the emergence of which depended on the iteration order of hashmaps, so subtlw changes caused by print calls would change the symptoms. If you have a debugger, this can usually be avoided.
-
@lorentz Bisect is fantastic for regressions, so long as your commit history is sensible. For bugs that have "always been there" though or with a convoluted git history - not so much.
-
@AlmondSauce `git bisect` is great if Git provides a roughly even sequence of changes. Bisection as a debugging technique however works along any breakdown of the code that is roughly even, although it does take longer. If you can formalize something that should not be happening but it is, then for any slicing of the code at least one part will be causing the problem. It's not really a grand idea if you generalize it this much, but it still works.
-
@AlmondSauce “write failing tests and get them to pass” is probably the best advice.
+ log whatever you can around whatever you could isolate
If you cannot reproduce issues in dev, isolate what’s different vs prod and test those manually (postman/curl)
Put down the flow in a chart and mark things green/red about which part works and which doesn’t. That’ll help isolate things for bigger flow where data moves between 15 systems to generate results. -
Feed whole codebase to one of GPT thingies;)
Alternatively, if being reasonable, I'd write tests and isolate stuff -
@Been-Outside If you are using "GPT thingies", use the Cursor IDE. First 50 calls to GPT-4 are free, and it is really cool (when it works).
-
@nanobot I am using those, but for minor things which I'm not sure how to start googling or would need to look up multiple sources. E.g. most recent one was about Excel macros. Never worked with those, will never work in future, so gpt is just simpler.
Or recipies. More often than not, those are great
Related Rants
Any tips on what to do after 2 days of trying to fix a bug in a published project cos I'm losing my mind right now??
question
rant
tips
bug