One of the first things I tell the junior/mid-level developers I mentor is "You can't debug something just by reading the code." We all have a mental model of how our code works, and it's usually a bit wrong. Bugs are the real world manifestations of those mistakes. When you read the code it's all filtered through your model, and that makes you blind to seeing why something unexpected happened. In order to debug some…
> "You can't debug something just by reading the code." This is exactly how I debug things. When I first started working I was forbidden from using the debugger “you won’t have a debugger in the field”. Being able to read the code, spot the bug and tie it to the symptoms; that’s a skill. A damned important skill.
But lots of bugs can and should be found and fixed by inspection of the code, inspired by a reasonable observation.
Depending on your process needs, maybe write a test to confirm the fix.