31
Was at a library workshop in Denver and someone showed me their broken code line by line.
Seeing the exact spot where a missing semicolon crashed their whole program made debugging click for me. Anyone have a simple trick for spotting those tiny syntax errors faster?
3 comments
Log in to join the discussion
Log In3 Comments
victor_jones9921d ago
My old CS prof swore by reading code backwards to catch missing punctuation.
1
nathan_shah20d ago
Yeah, I get the idea @victor_jones99, but reading backwards never clicked for me. It pulls the logic apart when you need to see how it flows together. I'd rather just run a linter to catch a missing semicolon. For a missing bracket, I find it faster to trace from the start of a function block forward, matching them in my head as I go. That way I'm still following the actual order of the code.
7
sam_thomas20d ago
Wait, your prof actually made you read code backwards? That sounds like a special kind of torture, @victor_jones99. My brain would just shut down trying to parse anything that way. Honestly, just scanning the screen while the IDE highlights matching braces works way better for me.
5