An anonymous snippet comes from the land of Visual Basic, where people continue to prove on a daily basis that simplicity of syntax offers no protection against screw-ups:

Having recently started a new programming job, I've quickly discovered what most of the day-to-day grind entails: Deciphering and cleaning poorly written Visual Basic code before actually being able to perform my assigned work. Our codebase has plenty of the usual suspects: Variables with meaningless names like "AA" and "bbb", thousand-line functions (which approach VB's built-in limits), no-ops, unreachable code, gobs of copy-and-pasted code, and a few instances of this little construct (irrelevant code removed):

If {condition} Then

        ' ...code here

        Goto skipIt

End If

' ...more code here


So the culprit came up with at least 4 screw-ups here: avoiding use of the 'Else' statement, introducing logical flow issues, potentially causing memory/compiler issues (abnormal exit from a block IF), and reducing overall code legibility.  I especially like how SkipIt is a label that just identifies that we skipped out from some previous code.  But what code did we skip?

If the IF block is large, and there is enough code in between, then we'd just randomly see "skipit" in the code and think to ourselves, "hmmm... wonder where we skipped here from?"

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!