Break; considered confusing

Currently filled with joy and a deep sense of fellowship about this toot from James Thompson:

To be clear: Thompson is a long-time mac indy mac developer, author of Pcalc and the much-missed DragThing.  He is, without a doubt, a Good Programmer.

I love this toot because it’s such a great example of how we all actually learn things in this craft—we aren’t taught so much as we accrete bit of lore over time.  Everthing I took an actual class in was obsolete by the turn of the century, so instead I have a head full of bits of techniques, cool facts, “things that worked that one tine”—lore.  We can’t always remember where we picked this stuff up, and often it’s half-remembered, context-free.  It’s not funny that he was wrong, it’s amusing that he knew something that didn’t exist.  How many cool tricks do I know that don’t exist, I wonder?

Mainly this caught my eye, though, because `break` is a statement I try to avoid as much as possible.  Not that break isn’t valid—is is!—but I’ve learned the hard way that if I find myself saying “and now I’ll break out of the loop” (or, lord help me, continue,) I am absolutely about to write a horrible bug.  I actually made a bad decision about five decisions back, my flow control is all messed up, and instead of breaking I need to take a deep breath and go for a walk while I think about what the right way to approach the problem was.

This is the flip side to lore—I think we all have areas where we havn’t collected enough lore, and for whatever reason we avoid instinctually so we don’t get ourselves into trouble.

Previous
Previous

Q1 2023 Links Clearinghouse

Next
Next

Wild Things at 25