Comment On Unconventional Naming

I haven't posted anything from my personal collection of WTF in quite a while, so here's something that I came across a little while back. It's (naturally) from a VBScript ASP page developed by some folks who just didn't quite understand the proper way of naming (or, for that matter, using) variables. I think this snippet (from a validation routine) speaks for itself ... [expand full text]
« PrevPage 1Next »

Re: Unconventional Naming

2005-02-16 13:20 • by JamesCurran

Oooh... I get to be the first responent....


Reminds my of a WTF I saw years ago.  (The original was in the funky script used by FileNet -- which is a WTF in itself -- so I'll translate into a more recognizable language)


char cArnold = "|";
for(i=0; i<len; ++i)
{
     /// TO stuff with str[i]
    if (str[i] == cArnold)
          break;
}


So, why is that variable called "Arnold"?  After ponding it for some time (that idoim was used often in the code), I finally realized --- because it was the terminator.

Re: Unconventional Naming

2005-02-16 13:20 • by Stan Rogers
Was that "true2" as in "true as well", or "too true"? Could things ever
become "true" enough to become "false" due to "disbelief" or
"astonishment"?

Re: Unconventional Naming

2005-02-16 13:27 • by logistix
 This is just the providing forward compatibility for boolean logic on quantum computers.

Re: Unconventional Naming

2005-02-16 13:29 • by

After ponding it for some time (that idoim was used often in the code), I finally realized --- because it was the terminator.


Dude, that is great.  I'm gonna start using that one...LOL

Re: Unconventional Naming

2005-02-16 13:47 • by skicow
Neat!  What's the next value after "true2"? "true4ever"? and what about "false2"?

Re: Unconventional Naming

2005-02-16 13:50 • by Phil Scott
i stumbled upon some code that had parameters that looked like this: p_sSaveSTR



I assume the p_ stood for "parameter," the s prefix stood for string,
and the STR was a backup for those who missed the s prefix.  The
interesting thing was that each method basically only accepted one
parameters, which would be a string in the format of "Phil|Scott|3025
Wentworth Ave" and then they'd use split to convert the string into the
array, and use the array to populate a recordset.



Got the job done, I guess.

Re: Unconventional Naming

2005-02-16 14:05 • by KraGiE

you can clearly see that this person hasn't taken a class in basic programming to find out that strings take up space as it's longer, and data types such as boolean take up minimal space. 


"true", "false"... that's the wtf.  then when you validate against that variable, you're doing a string comparision that's always more time consuming than a boolean or integer based comparison.


The "true2" just reminds me of a vb guy click/dragging a button on the form, and leaving them "Button1" and "Button2".  Looks like hate code to me.  :)

Re: Unconventional Naming

2005-02-16 14:10 • by

That "Arnold" story reminded me of one from my very first programming job.  This was back in the Dark Days when people actually had to maintain MAKE files by hand.  I realized that because of the company standards we had adopted (one header for each module, base names must match, no circular references), it was trivial to write a program that scanned our source code and automatically built the MAKE file.


So I built it. This was a tool for our own internal use, not production code, so I decided I could have some fun in it.


In the data structures inside that program was a variable named GuzintaFile.  Someone asked me what that meant?  "Well," I said, "one file GOES INTO the compile of another...".

Re: Unconventional Naming

2005-02-16 14:43 • by Blue
29803 in reply to 29794
One time, in the very beginning of my career, in some FoxPro (xBase)
production code I wrote while consulting for Wells Fargo,  I was
having a little bit of fun with the code, and wrote something
approximately like the following:



Here's the p-code:

1. get input from user

2. find row in table based on index seek using user input

3. display resultant row



Now, FoxPro doesn't enforce type safety on variables, AND I made the
horrible mistake of not validating the input before using
it.   Also, the version of FoxPro I was using at the time had
no notion of Debug vs Release, so when an error occurred, a pretty
dialog box appeared showing the offending line of code that raised the
error.



In order to create a pun using the language, and because I'm was/am a sexist male pig, I chose to name my variable "blowjob".



So the real code was something like:



...

blowjob = GetInputValueFromForm(I forget the actual function name, but you get it)

SELECT tablename

SEEK blowjob

...



Well, it was a numeric field and he typed some alpha characters in, and
whammo, dialog box appears saying "An Error has occurred.  
SEEK BLOWJOB".  Of course, the dialog only had an "OK" button on
it, which added to the hilarity.



Yes, I should have been fired, but the manager I reported to thought it
was hilarious as the end user of this application was in fact quite
uptight.





Re: Unconventional Naming

2005-02-16 14:49 • by Drak
29806 in reply to 29794

I think we've all gotten to the point where you had yet another counter/label/sub name and had to think up some name for it.


My best (and I think it was quite common in those days) example comes from Turbo Basic (which needed no line numbers):


... code here ...
Hell:
... more code here ...
if ... something or other ... then goto hell


For any dutch speaking people here, on my university x86 assembly project I used a label 'NaarDePomp'. Nice label to use in a loop ;)


(For people who don't read dutch, literally it would say 'Walk to the (water)pump' which basically means 'get outta here' or 'goto hell'.)


Drak

Re: Unconventional Naming

2005-02-16 14:53 • by Drak

Blue's message reminds me of this:


http://digilander.libero.it/chiediloapippo/Engineering/iarchitect/stupid.htm


The site is really a good laugh.


Drak

Re: Unconventional Naming

2005-02-16 14:54 • by

This is hilarious.  


I suppose "true" is equal to true.  And when does "true2" get's used?

Re: Unconventional Naming

2005-02-16 15:00 • by
29811 in reply to 29785
JamesCurran:

So, why is that variable called
"Arnold"?  After ponding it for some time (that idoim was used
often in the code), I finally realized --- because it was the
terminator.





I've got a few like that.



"Why is this program named betsy_ross?"



"Don't you know?  That is the program you run to set the flags!"



"Okay, why is this one rotisserie?"



"That one takes a slice of the cylinder and rotates it to create a full cylinder!"



"And this one named x-ray?"



"It lets you view inside data files to see the variables."



"Oh, now I'm getting it.  So this one, named executioner, it probably kills off other programs, right?"



"No, that one just runs programs."



Re: Unconventional Naming

2005-02-16 15:05 • by JamesCurran

Well, since everyone like the "Arnold" story, let's me tell you about, My Nightmare, part II (Almost certainly the same programmer, possibly the same file)


DocumentTypes[] Shakes = GetDocumentTypes();
for(int i =0; i< Shakes.Length; ++i)
     ProcessDocumentType(Shakes[i]);


So, why was an array of DocumentTypes called "Shakes"?  Anyone?  Bueller?


 


 


Because a DocumentType was called a "DT" and the "DTs" ("Delirium tremens")(http://www.answers.com/topic/delirium-tremens) are the "Shakes"

Re: Unconventional Naming

2005-02-16 15:09 • by Blue
29814 in reply to 29808
Drak, that was a funny site indeed!  The only example close to
mine was the Autodesk tooltip with "idiot" in it... But still, quite
funny!



Re: Unconventional Naming

2005-02-16 15:14 • by JamesCurran
29816 in reply to 29811

:

"Oh, now I'm getting it.  So this one, named executioner, it probably kills off other programs, right?"

"No, that one just runs programs."


PowerBuilder has a dialog box where you can build & test SQL statements.  The toolbar button which run (i.e., "executes") the query, has just an axe on it.  I'm told that during the beta, it was a bloody axe.


 

Re: Unconventional Naming

2005-02-16 15:46 • by Drak
29820 in reply to 29816

More proof that all developers have a morbid sense of humor.


Drak

Re: Unconventional Naming

2005-02-16 19:04 • by Bustaz Kool
29835 in reply to 29789

skicow:
Neat!  What's the next value after "true2"? "true4ever"? and what about "false2"?


Truest?


MoreTrue?


True.Degree = Nth ??


Power(True, MAX)      (See cArnold above)

Re: Unconventional Naming

2005-02-17 01:17 • by Drak
29852 in reply to 29785
JamesCurran:
char cArnold = "|";
for(i=0; i<len; ++i)
{
     /// TO stuff with str[i]
    if (str[i] == cArnold)
          break;
}

So, why is that variable called "Arnold"? 


Haha! I copy pasted this to a colleague, and the first words he said were 'What the f*ck?!?' without even knowing where this snippet came from [:O]


Drak

Re: Unconventional Naming

2005-02-17 03:58 • by
29860 in reply to 29785
JamesCurran:

Oooh... I get to be the first responent....


Reminds my of a WTF I saw years ago.  (The original was in the funky script used by FileNet -- which is a WTF in itself -- so I'll translate into a more recognizable language)


char cArnold = "|";
for(i=0; i<len; ++i)
{
     /// TO stuff with str[i]
    if (str[i] == cArnold)
          break;
}


So, why is that variable called "Arnold"?  After ponding it for some time (that idoim was used often in the code), I finally realized --- because it was the terminator.



 


Heh, that's great humour!  One should always be allowed a little fun while coding as long as it is not overdone!

Re: Unconventional Naming

2005-02-17 04:51 • by
True 2 - for all those times when True just isn't True enough.



[N]

Re: Unconventional Naming

2005-02-17 04:56 • by
29865 in reply to 29790





i stumbled upon some code that had parameters that looked like this: p_sSaveSTR



I assume the p_ stood for "parameter," the s prefix stood for string,
and the STR was a backup for those who missed the s prefix. 



Prefix naming convention - now that's a WTF in itself.



At least they didn't name it sStringSTR I guess [:)]

Re: Unconventional Naming

2005-02-17 06:03 • by
29867 in reply to 29806
Drak:

For any dutch speaking people here, on my university x86 assembly project I used a label 'NaarDePomp'. Nice label to use in a loop ;)


(For people who don't read dutch, literally it would say 'Walk to the (water)pump' which basically means 'get outta here' or 'goto hell'.)


Drak



Another dutch funny variable name:


in a project i had to use dutch variablenames, prefixes(3 letters) which indicate the type of variable (not very uncommon) so i had to store a receivingchannel for a message over a queue. in dutch, receivechannel = "OntvangstKanaal" added a prefix for a string type it would be strOntvangstKanaal which could be literally translated as shit-catch-channel


After a reviewer of the customer waded through the code, i had to change it into another variablename

Off-Topic: problematic use of &quot;em&quot; in font-size

2005-02-17 06:51 • by
<div style="font-size: 30pt">font-size: 30pt

  <div style="font-size: 0.7em">font-size: 0.7em

   
<div style="font-size: 0.7em">font-size: 0.7em

      <div style="font-size: 0.7em">font-size: 0.7em

      </div>

    </div>

  </div>


</div>



gets:


font-size: 30pt
font-size: 0.7em
font-size: 0.7em
font-size: 0.7em



This is the cause of some strange font sizing problems in this topic.
"em" refers to the parent font size and so nested use of e.g. "0.7em"
causes shrinking of the text. (see used stylesheet in the source,
classes txt1-txt5).

Re: Off-Topic: problematic use of &quot;em&quot; in font-size

2005-02-17 06:52 • by
29869 in reply to 29868
replace "topic" with "forum"

Re: Unconventional Naming

2005-02-17 07:47 • by
29872 in reply to 29803
I had a routine lying around that parsed a string in the form
<verb> <arg=value> <arg=value> ... However, I needed
to parse a similar string, one that didn't contain a verb. No problem
really, all I needed to do was put a dummy verb in the string. That one
I called... You guessed it, "dummy".



Now, if the system found a string it couldn't parse, it would split out
an error message and include the string in order to help understand the
problem.



Hilarity ensued when one day I accidentally passed an empty string to
the parser, triggering a validation error that read something like:



"Unable to parse string: dummy."



Luckily I caught that one during testing. I can imagine customers might
not have been entirely amused by the phrasing of that particular error
message...





Re: Unconventional Naming

2005-02-17 08:18 • by
its obviously a fuzzy logic true.

Re: Unconventional Naming

2005-02-17 08:51 • by
son of a bitch.

Re: Unconventional Naming

2005-02-17 12:03 • by
i once worked with a guy who named a java interface IInterface. yep,
two I's (the first one is to indicate that this is, indeed an interface
(not a class). what to make of the remaining "Interface" part of the
name is up to all of you.

Re: Unconventional Naming

2005-02-17 12:38 • by
true for a given value of true.....  I don't think this guy has
found his true vocation yet, perhaps programming isn't for him and the
career of a politician beckons.

Re: Unconventional Naming

2005-02-17 13:02 • by

Working at a local university many, many years ago, I had my hand in a number of applications that were basically the same (e.g. keeping track of "things"), but were different enough to make the job interesting.


The applications were developed on an old VAX system, and were executed by the users via the use of COM files (just like the MS-DOC BAT files).  Our naming convention at the time was to create three letter COM file names.  For example, the COM file that ran the telephone inventory system application was named TIS.COM.


I wrote an application that kept track of student athlete information.  I must have been in a good mood the day I named that COM file because instead of using SAI.COM, I used JOX.COM...


Get it?

Re: Unconventional Naming

2005-02-17 13:32 • by
29887 in reply to 29860
Fun in cool.  Cleverness (especially when it comes to variable names) for its own sake is dumb.  cArnold is dumb.

Re: Unconventional Naming

2005-02-17 19:31 • by JamesCurran
29938 in reply to 29885

:
I used JOX.COM...


Some years ago, Someone I know write a simple database app for his friend's wife. It was called "Terry's Information Tracking System" --- with the appropriate abbreviation for the filename.

Re: Unconventional Naming

2005-02-18 02:35 • by
29953 in reply to 29884
:
true for a given value of true.....  I don't think this guy has
found his true vocation yet, perhaps programming isn't for him and the
career of a politician beckons.



Perhaps programming is his true vocation, but politics is his true2 vocation.

Re: Unconventional Naming

2005-02-18 16:12 • by
true, true

Re: Unconventional Naming

2005-02-18 17:03 • by Schol-R-LEA
30023 in reply to 29803
In the first paid programming job
I ever did (I was actually a salesman for the store, but they needed a
POS system and didn't want to pay for one), I was using Foxpro 2.5 for
MS-DOS. As a typical snarky first-timer, I had some fun with the
variable names: for example, the customer table was named SUCKERS, the
employee table was SLAVES, and the error message window was S_O_L. The
worst was a boolean variable which marked whether or not a customer was
in the database; as a nod to both Lisp and the Jargon File, I dubbed it
CUS_P.

Re: Unconventional Naming

2005-03-15 21:45 • by
31263 in reply to 29788
[:P]very funny but great idea



me too!


Dude, that is great.  I'm gonna start using that one...LOL

[/quote]
« PrevPage 1Next »

Add Comment