True! No, false! No, true!



  • Code snippet of the week, or maybe month. This developer gives VB6 a bad name. He does it all:

    • Random indentation. Why should things look consistent?
    • Commented-out code. You never know when you'll need some wrong code again.
    • Obscure and haphazard names. Consistency is for dweebs!
    • This developer uses a coding technique I call "beating the code into submission."
    • And (almost) True, False, FileNotFound.

    All demonstrated in this code snippet that drove me to submit to TDWTF:

    Private Sub lblExpChange()

       If lblexp.Tag = "-" Then lblScDtl1.Visible = False

       lblScdtl2.Visible = False

       Picture3.Visible = True <FONT color=green>'False 'True </FONT>



  • I agree with most of your assessment, but I don't think you are correct on the indenting issue.  Three spaces is a weird indent, but it is consistent and correct.



  • @Jaime said:

    I agree with most of your assessment, but I don't think you are correct on the indenting issue.  Three spaces is a weird indent, but it is consistent and correct.

    He didn't say the indenting problem was evidenced in this particular snippet, more in his overall work output.



  • @Flatline said:

    @Jaime said:

    I agree with most of your assessment, but I don't think you are correct on the indenting issue.  Three spaces is a weird indent, but it is consistent and correct.

    He didn't say the indenting problem was evidenced in this particular snippet

     

    @D-Coder said:

    All demonstrated in this code snippet



  • @bstorer said:

    @Flatline said:

    @Jaime said:

    I agree with most of your assessment, but I don't think you are correct on the indenting issue.  Three spaces is a weird indent, but it is consistent and correct.

    He didn't say the indenting problem was evidenced in this particular snippet

     

    @D-Coder said:

    All demonstrated in this code snippet

    Ah, OK, then I guess he did.



  • @D-Coder said:

    This developer VB6 gives VB6 a bad name.

     

     

    FTFY.



  • @Flatline said:

    @bstorer said:

    @Flatline said:

    @Jaime said:

    I agree with most of your assessment, but I don't think you are correct on the indenting issue.  Three spaces is a weird indent, but it is consistent and correct.

    He didn't say the indenting problem was evidenced in this particular snippet

     

    @D-Coder said:

    All demonstrated in this code snippet

    Ah, OK, then I guess he did.

    My bad. The indentation in the snippet was in fact okay (unless I mangled it into correctness along the way). But if you hit yourself in the head repeatedly with a dense object, you can imagine what the indenting in several hundred other lines of code was like.



  •  Yes. 'No.'Yes.



  • @Jaime said:

    Three spaces is a weird indent, but it is consistent and correct.

     

    Oh no - three spaces (5 or 7 also work) indenting is perfect for proving that you should really use tabs instead. It goes like this:

    - (tab person) We could use tabs and everyone can just see whatever they like.
    - (spaces person) No we need to use spaces! Spaces FTW!!!
    - (tab person) Ok, 3 spaces it is.



  • @viraptor said:

    @Jaime said:

    Three spaces is a weird indent, but it is consistent and correct.

     

    Oh no - three spaces (5 or 7 also work) indenting is perfect for proving that you should really use tabs instead. It goes like this:

    - (tab person) We could use tabs and everyone can just see whatever they like.
    - (spaces person) No we need to use spaces! Spaces FTW!!!
    - (tab person) Ok, 3 spaces it is.

    Speaking of WTFs at work, I inherited a large code base with mixtures of tabs and spaces.  I don't mean normal things like older code from developer x has tabs and newer code from developer y has spaces.  I means a typical line might be:

    <tab><tab><space><tab><space><space><space><space>code

    When I open the source files in Notepad++ with whitespace annotations turned on, my eyeballs almost explode.  My favorite problem is when holding down the delete key, deleting radically accelerates because the beginnings of lines are typically tab heavy.  I usually end up deleting part of the previous line before I realize I've entered a "tab zone".



  • Another good VB6 one that I'm sure you have is inconsistent capitalization.  This is one of the hallmarks of really bad VB6 code because one of the best ways to make it is to do a lot of typing after making the code unparsable by the IDE.  For me, as soon as intellisense stops working, I go and fix whatever broke it.  I don't understand why these people type hundreds of lines of code without intellisense.



  • @viraptor said:

    @Jaime said:

    Three spaces is a weird indent, but it is consistent and correct.

     

    Oh no - three spaces (5 or 7 also work) indenting is perfect for proving that you should really use tabs instead. It goes like this:

    - (tab person) We could use tabs and everyone can just see whatever they like.
    - (spaces person) No we need to use spaces! Spaces FTW!!!
    - (tab person) Ok, 3 spaces it is.

    My first style guideline is "don't fight the defaults".  Visual Studio has been converting tabs to spaces for as long as I've used it (16 years).



  • @Jaime said:

    My first style guideline is "don't fight the defaults".  Visual Studio has been converting tabs to spaces for as long as I've used it (16 years).

     

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake. That's weird, and doesn't work with my brain-- in my brain, one keypress = 1 backspace.

    So yeah, that's the first default I change. It doesn't matter since I don't work with anybody whose opinion I respect.



  • @blakeyrat said:

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake. That's weird, and doesn't work with my brain--
    Have you ever used Community Server? It doesn't seem to suffer from that problem...



  • @blakeyrat said:

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake.

    Try Shift+Tab instead.



  • @blakeyrat said:

    @Jaime said:

    My first style guideline is "don't fight the defaults".  Visual Studio has been converting tabs to spaces for as long as I've used it (16 years).

     

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace *4* times to correct your mistake. That's weird, and doesn't work with my brain-- in my brain, one keypress = 1 backspace.

    So yeah, that's the first default I change. It doesn't matter since I don't work with anybody whose opinion I respect.

    Try backspace in VB6.  The most likely explanation for the random indenting in the OPs code is VB6's backspace handling.  For example, if you leave the indenting setting at the default of four, you can indent to any distance you want and not even notice the four until you hit backspace.  It works like this:

    1.  Type beginning of block statement, hit enter.
    2.  IDE doesn't indent.  Hit space twice, type next line.
    3.  IDE aligns next line indented at two spaces (yes, even with indenting set to four spaces).
    4.  After the last statement of the block, hit enter and backspace to unindent.  Freakin' IDE will unindent four spaces, not aligning the beginning and end of the block.

    It will, however, fix your backspace problem if you indent with the tab key.  It will convert the tabs to spaces when you hit tab and actually eat four spaces at a time when you backspace.  All this screwyness is due to VB6 not having block-completion and the IDE trying to avoid guessing block endings.



  • @fatbull said:

    @blakeyrat said:

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake.

    Try Shift+Tab instead.

     

    I'm with you, but that's not how I delete accidental presses of the other 104 keys on the keyboard.

    1 keypress -> 1 character in the file -> 1 backspace to get rid of

    Anything else is just confusing. I don't like confusing.



  • @blakeyrat said:

    @fatbull said:

    @blakeyrat said:

    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake.

    Try Shift+Tab instead.

     

    I'm with you, but that's not how I delete accidental presses of the other 104 keys on the keyboard.

    1 keypress -> 1 character in the file -> 1 backspace to get rid of

    Anything else is just confusing. I don't like confusing.

    On embedded irish girls, more than just one key will confuse things if you try and undo it by pressing backspace. It's a sad thing to see a grown man struggle with caps lock.



  • @PJH said:

    @blakeyrat said:
    I wouldn't mind spaces, except if you accidentally tab too far, you have to hit backspace 4 times to correct your mistake. That's weird, and doesn't work with my brain--
    Have you ever used Community Server? It doesn't seem to suffer from that problem...
    But you still have to press Bacspace twice



  • @blakeyrat said:

    I don't work with anybody whose opinion I respect.

    And he's self-employed, folks!

    ba-ba-damm-tishhh!



Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.