Get systematic: Remove possible variables in the code until you can isolate the problem. This is why it's important to be disciplined with your version control so you can freely delete swaths of code without complicating your life by being in the middle of some huge edits when you're trying to do it.
Learn something new every day.
- I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Location
Buenos Aires
Education
Computer Science Degree at Universidad de Buenos Aires
Beginner-friendly programming tips, tutorials, and resources. Follow us for the topics to kickstart your journey in the world of code. https://marinsborg.com
I agree with what people already wrote here. Maybe good idea would be to take pen and paper and draw what code does on more abstract level and then start with rubber duck method.
Oldest comments (23)
Run the same code 4 more times to make sure it’s a real bug. If it is, it’s time to get the rubber ducky🐥
If ducky can't help, I just ask this senior web developer for advice!
Get systematic: Remove possible variables in the code until you can isolate the problem. This is why it's important to be disciplined with your version control so you can freely delete swaths of code without complicating your life by being in the middle of some huge edits when you're trying to do it.
Add a failing test.
Debug it in isolation
I got a few:
Use breakpoints.
I agree with what people already wrote here. Maybe good idea would be to take pen and paper and draw what code does on more abstract level and then start with rubber duck method.
Sleep on it
I can't even remember how many times I was stuck on a problem for hours and it just took some minutes to solve the next morning after some rest