Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. The worst way to name a variable

The worst way to name a variable

Scheduled Pinned Locked Moved The Weird and The Wonderful
lounge
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DaintyB
    wrote on last edited by
    #1

    Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.

    function randomNumber(){
    var lunchtimeMondayReturn=0;
    while(true){
    var lunchtimeMonday=Math.random();
    if(!((lunchtimeMonday+'').split('')[2]>3)){
    lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
    break;
    }
    }
    return lunchtimeMondayReturn;
    }

    P A B B 4 Replies Last reply
    0
    • D DaintyB

      Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.

      function randomNumber(){
      var lunchtimeMondayReturn=0;
      while(true){
      var lunchtimeMonday=Math.random();
      if(!((lunchtimeMonday+'').split('')[2]>3)){
      lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
      break;
      }
      }
      return lunchtimeMondayReturn;
      }

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      In a Pascal class in college I used all nonsense words. QUAMPANI, BELABA, DEFALA, TANEKABI, etc.)

      A D 2 Replies Last reply
      0
      • P PIEBALDconsult

        In a Pascal class in college I used all nonsense words. QUAMPANI, BELABA, DEFALA, TANEKABI, etc.)

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #3

        PIEBALDconsult wrote:

        TANEKABI

        That's somewhat close to Tenkaichi.

        Thou mewling ill-breeding pignut!

        A 1 Reply Last reply
        0
        • P PIEBALDconsult

          In a Pascal class in college I used all nonsense words. QUAMPANI, BELABA, DEFALA, TANEKABI, etc.)

          D Offline
          D Offline
          DaintyB
          wrote on last edited by
          #4

          Lol. I've done that before... I'm terrible at naming variables.

          1 Reply Last reply
          0
          • A AspDotNetDev

            PIEBALDconsult wrote:

            TANEKABI

            That's somewhat close to Tenkaichi.

            Thou mewling ill-breeding pignut!

            A Offline
            A Offline
            Andrei Straut
            wrote on last edited by
            #5

            I rather like Vegeta[^], although it's a character name rather than a series

            Full-fledged Java/.NET lover, full-fledged PHP hater. Full-fledged Google/Microsoft lover, full-fledged Apple hater. Full-fledged Skype lover, full-fledged YM hater.

            1 Reply Last reply
            0
            • D DaintyB

              Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.

              function randomNumber(){
              var lunchtimeMondayReturn=0;
              while(true){
              var lunchtimeMonday=Math.random();
              if(!((lunchtimeMonday+'').split('')[2]>3)){
              lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
              break;
              }
              }
              return lunchtimeMondayReturn;
              }

              A Offline
              A Offline
              Andrei Straut
              wrote on last edited by
              #6

              If that were Java, you could put it in a class and use some accessors in a really nice way: isLunchTimeMonday() getLunchTimeMonday() Although properties in .NET make a really nice way too: var whatTimeIsIt = HungryClass.LunchTimeMonday

              Full-fledged Java/.NET lover, full-fledged PHP hater. Full-fledged Google/Microsoft lover, full-fledged Apple hater. Full-fledged Skype lover, full-fledged YM hater.

              1 Reply Last reply
              0
              • D DaintyB

                Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.

                function randomNumber(){
                var lunchtimeMondayReturn=0;
                while(true){
                var lunchtimeMonday=Math.random();
                if(!((lunchtimeMonday+'').split('')[2]>3)){
                lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
                break;
                }
                }
                return lunchtimeMondayReturn;
                }

                B Offline
                B Offline
                BillW33
                wrote on last edited by
                #7

                Ano Anony Wrote:

                Lol, I wrote this a few years ago for a school project...

                I hope you are better at naming variables now. ;) :)

                Just because the code works, it doesn't mean that it is good code.

                1 Reply Last reply
                0
                • D DaintyB

                  Lol, I wrote this a few years ago for a school project... I think I wrote it on Monday at lunchtime.

                  function randomNumber(){
                  var lunchtimeMondayReturn=0;
                  while(true){
                  var lunchtimeMonday=Math.random();
                  if(!((lunchtimeMonday+'').split('')[2]>3)){
                  lunchtimeMondayReturn=(lunchtimeMonday+'').split('')[2];
                  break;
                  }
                  }
                  return lunchtimeMondayReturn;
                  }

                  B Offline
                  B Offline
                  Brisingr Aerowing
                  wrote on last edited by
                  #8

                  I know a kid who names his variables x, xx, xxx, xxxx, and so on and so forth. His methods have names like "JDOEHSNFD" (Note all caps). The professor was not very happy when trying to read (and grade) his code. The student also did things like 'String xxx = "879374930";' and then the next line would be 'int xxxx = Integer.parse(xxx).intValue();' The string variable would not be referenced AT ALL after that! Is it any wonder he failed?

                  Bill Gates is a very rich man today... and do you want to know why? The answer is one word: versions. Dave Barry Read more at [BrainyQuote](http://www.brainyquote.com/quotes/topics topic_technology.html#yAfSEbrfumitrteO.99)[^]

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups