r/learnprogramming • • Mar 07 '23

Is it normal as a junior programmer..

To spend hours looking over the same block of code, trying to sort out ‘why the f*ck isn’t this working!?’, only to realize the error you made is so monumentally, and stupidly obvious that it leaves you feeling like a completely useless moron? Lol

1.6k Upvotes

297 comments sorted by

View all comments

Show parent comments

13

u/mysticreddit Mar 07 '23

Also using a better text editor that lets you have a branching history / undo can help — that way you can go forward/backwards to narrow down the change(s) that caused the issue.

Even if you only have a linear undo history saving every N changes to unique files will let you do a visual difference to spot the bug.

  • Save foo.100

  • Undo 25 times, save foo.75

  • Undo 25 times, save foo.50

  • Undo 25 times, save foo.25

  • Undo 25 times, save foo.0

Now you can do diff foo.25 foo.50, compile a specific version, etc.

0

u/[deleted] Mar 08 '23

[deleted]

3

u/mysticreddit Mar 08 '23

That’s what git bisect is for.

You are using version control, right? :-)

Commit early, commit often.