José received a bit of VB .Net UI code that left him scratching his head.

While IsNothing(Me.FfrmWait)
    If Not IsNothing(Me.FfrmWait) Then
        Exit While
    End If
End While

While a form doesn’t exist, if the form does exist, break out of the loop. I suspect this was intended as a busy loop, waiting for some UI element to be ready. Because busy loops are always the best way to wait for things.

But even with the busy loop, the If is a puzzle- why break out of the loop early, when the loop condition is going to break itself? Did they just not understand how loops work?

Now, the last thing to note is the variable naming conventions. frmMyForm is a common convention in WinForms programming, a little bit of Hungarian notation to tell you what the UI element actually is. But what’s that *leading F there? Are they… doing a double Hungarian? Does it tell us that this is a form? Or maybe they’re trying to tell us that it’s a field of the class? Or maybe a developer was saying “F my life”?

We’d all be better off if this code were nothing.

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

Remy Porter

Source link

You May Also Like

This Week In Local April 13, 2024

Read more… Source link

My First Time Meeting Grandma

“This is the photo of my grandmother holding me just hours after…

So… You’re Havin’ A Bad Day (17 Photos)

Hendy Source link

GIFs of BEST prt-2…“Did NOT see Coming” (30 GIFs)

Rick Source link