More casing woes



  • Oh dear, I'd forgotten just how horrible VB6/VBA was after working with .NET for so long. The IDE has the handy feature of keeping your casing in variable names in order. Sure, the language is case insensitive, but tidy is good. Sounds good, right?

    Unfortunately it gets overzealous and re-cases every variable by that name in the entire file. And function names. And the application's built-in objects. And enumerations, and their contents. Most likely anything else it can get its hands on, too.

    Sub rANGE()
        Dim rANGE As exCeL.rANGE
    End Sub

    Sub Foo()
        Dim rANGE As exCeL.rANGE
    End Sub

    Enum exCeL
        exCeL = 1
        rANGE = 2
    End Enum

    OK, so the above is an especially nasty thing to do, but it's just one more reason why I hate going back to the bad old days.

    Maybe I just shouldn't work on maintenance projects that have so many TLAs, ETLAs, and VETLAs that are also real words, and names of application objects .



  • Yeah. I can't remember how many times I forgot and wrote a function that took "string as String".

    The only thing nastier than looking at code like that is having to put it right by temporarily naming variants after existing types!

    Dim String

    Dim Range

    Dim Excel

    Dim ThisSoCalledFixIsTheRealWTF

    Dim TheGogglesTheyDoNothing

     



  • @RayS said:

    Maybe I just shouldn't work on maintenance projects that have so many TLAs, ETLAs, and VETLAs that are also real words, and names of application objects .

     Hmm. I prefer to use "3GTLA" (Third Generation Three Letter Acronym) for that one. And CT (Compact TLA) for two. I Haven't got one for 6 lltter acronyms.
     



  • @robbak said:

    @RayS said:

    Maybe I just shouldn't work on maintenance projects that have so many TLAs, ETLAs, and VETLAs that are also real words, and names of application objects .

     Hmm. I prefer to use "3GTLA" (Third Generation Three Letter Acronym) for that one. And CT (Compact TLA) for two. I Haven't got one for 6 lltter acronyms.

    MBTLA - the Multi-Byte Three Letter Acronym, can vary in length depending on the encoding type or codepage currently used.  If you're using WTF-8 as your MBTLA encoding, your MBTLA can be up to six characters long per encoded character.  You really don't want to know about Shift-JIS MBTLAs when they can include Kanji characters.

     



  • @joe_bruin said:

    MBTLA - the Multi-Byte Three Letter Acronym, can vary in length depending on the encoding type or codepage currently used.  If you're using WTF-8 as your MBTLA encoding, your MBTLA can be up to six characters long per encoded character.  You really don't want to know about Shift-JIS MBTLAs when they can include Kanji characters.
    K̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́̕̚͠͡ͅà̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́̕̚͠͡ͅǹ̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́̕̚͠͡ͅj̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́̕̚͠͡ͅi? Who needs kanji?



  • @leonita79 said:

    Yeah. I can't remember how many times I forgot and wrote a function that took "string as String".

    This is usually a bad idea even in case-sensitive languages.  Variable names, especially in function parameter lists, are just as important as function names.  They should describe what the variable is being used for (not what type the variable is).



  • @burnmp3s said:

    @leonita79 said:

    Yeah. I can't remember how many times I forgot and wrote a function that took "string as String".

    This is usually a bad idea even in case-sensitive languages.  Variable names, especially in function parameter lists, are just as important as function names.  They should describe what the variable is being used for (not what type the variable is).

    How do you know that he's not writing software for a yarn shop? ;-)

    But that's a good point too. One thing I hate when going through other people's code is lame variable names, be it (a,b,c,d,e) or 'string'. One thing that I see a LOT of going through VBA code is the myXYZ pattern. myString, myInteger, myRange.. argh! I guess that this is how the "xyz for dummies" books say to do it or something.



  • The "my" system has its advantage.  By declaring myInteger, myInteger2, myInteger3, etc., you know exactly how many integer variables you've declared in each function (besides myGlobalInteger, myGlobalInteger2, etc).  So you calculate quickly how much memory you're using.  Or something.


Log in to reply