Comment On Not Just Another RLB o'PCC

RLB o'PCC (or for those not acronym acquainted, Really Long Blocks of Pointless Conversion Code) are pretty common place. They're the type of code that goes something like If SomeInt = 4 Then SomeStr = "4", If SomeInt = 5 Then SomeStr = "5", .... If you haven't seen your fair share of this in the wild, you could find more than your fair share in examples I've posted over the year. Today's code (from Dan Fisch) might look at first glance like every other RLB o'PCC. But take a closer look; each of those Let* functions opens up to another 30-line RLB o'PCC that sets its character's ASCII value to an integer. I'll leave what those RLB o'PCC look like to your imagination ... [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Not Just Another RLB o'PCC

2005-10-28 14:02 • by Broonix
   First post! [6]

Re: Not Just Another RLB o'PCC

2005-10-28 14:05 • by Dave
I particularly like that each and every if test will get executed.....

Re: Not Just Another RLB o'PCC

2005-10-28 14:06 • by Yoey
48610 in reply to 48605
This makes baby jesus cry.



And why all the switching between char and ascii values as integers going on?

Re: Not Just Another RLB o'PCC

2005-10-28 14:15 • by Anonymoose
48611 in reply to 48605
Anonymous:
   First post! [6]




Wow, great post, relevant AND funny.





Suggestion for next version of code:

version 1:
if
(lcrBuffer.CurrentChar == '&')
LetAmpers(lcrBuffer, lmpAction);
if (lcrBuffer.CurrentChar == '@')

etc...



version 2:

	lmpAction = (int)lcrBuffer.CurrentChar;

	usleep(20);



Re: Not Just Another RLB o'PCC

2005-10-28 14:16 • by Oby Sam Kenoby
Maybe someone should tell this genius that "code reusability" and "copy & paste" are different things....

Re: Not Just Another RLB o'PCC

2005-10-28 14:19 • by Mung Kee
The most f-ed thing is, there is a separate function for each of the
conditions.  My guess is there is a whole WTF library that is
quite rich.



LetAmpers
LetAt
LetBackSlash
LetColon
etc.


Re: Not Just Another RLB o'PCC

2005-10-28 14:20 • by procyon112
I also like how it's not even in ASCII order, or a switch statement, so
not only is each case tested for every case, but there's no hope for
the compiler to optimize it in the slightest.

Re: Not Just Another RLB o'PCC

2005-10-28 14:23 • by johnl
48617 in reply to 48616
O
M
G

(The fact that I've managed to get a post on the first page shows just how speechless the rest of the community is)

Re: Not Just Another RLB o'PCC

2005-10-28 14:25 • by Gene Wirchenko
Alex Papadimoulis:
RLB o'PCC (or for those not acronym
acquainted, Really Long Blocks of Pointless Conversion Code) are pretty
common place.


Please do not strain for acronyms.  It is undignified.  (See the rest of the IT industry for copious examples.)


95 ifs.  The cases include TAB and CR.  That means two displayable 7-bit ASCII characters got left out.


Sincerely,




Gene Wirchenko



Re: Not Just Another RLB o'PCC

2005-10-28 14:28 • by Maurits
(hyperventilating) ... must... tear my eyes away...

Re: Not Just Another RLB o'PCC

2005-10-28 14:34 • by Eric the .5b
The horror. The horror.

Re: Not Just Another RLB o'PCC

2005-10-28 14:35 • by fred
My eyes!!!!  The goggles - they do NOTHING!!!

Re: Not Just Another RLB o'PCC

2005-10-28 14:39 • by Ongle
It isn't just this massive list of mutually exclusive conditions, consider that someone actually wrote 95 different LetFooBar() functions also.

Re: Not Just Another RLB o'PCC

2005-10-28 14:45 • by Gene Wirchenko
48625 in reply to 48624
Anonymous:
It isn't just this massive list of mutually exclusive conditions, consider that someone actually wrote 95 different LetFooBar() functions also.




I doubt that is true.  Probably, one procedure was written 95 times.  Drool-cut-and-paste rules.



Sincerely,



Gene Wirchenko



Re: Not Just Another RLB o'PCC

2005-10-28 14:48 • by iAmNotACantalope
This guy is my new hero.   I've decided that I will never use any class that contains less than 73 if statements.

In fact, I've decided that I won't do anything without includeing at least 2 if statments.


if( thisGuyIsStupid ) if( amIRight ) fufilledMyIfQuotaForThisPost();

pi

Re: Not Just Another RLB o'PCC

2005-10-28 14:49 • by a0a
48627 in reply to 48625
Gene Wirchenko:
Anonymous:
It isn't just this massive list of mutually exclusive conditions, consider that someone actually wrote 95 different LetFooBar() functions also.




I doubt that is true.  Probably, one procedure was written 95 times.  Drool-cut-and-paste rules.



Sincerely,




Gene Wirchenko






I`d have hoped you were kidding..

Re: Not Just Another RLB o'PCC

2005-10-28 14:51 • by craptastic
48628 in reply to 48625
This is museum quality!

Re: Not Just Another RLB o'PCC

2005-10-28 14:52 • by Otto
48629 in reply to 48611
Anonymoose:

version 2:
	lmpAction = (int)lcrBuffer.CurrentChar;

usleep(20);
Where this gets really sick is in these particular lines:
if (lcrBuffer.CurrentChar == 34)

LetQuotMarc(lcrBuffer, lmpAction);
if (lcrBuffer.CurrentChar == 39)
LetSingleQuotMarc(lcrBuffer, lmpAction);
Note that the guy clearly knows that you can treat a char as an int, but continues in the pointless code anyway.

Re: Not Just Another RLB o'PCC

2005-10-28 14:54 • by Mung Kee
48632 in reply to 48629
Otto:
Anonymoose:

version 2:
	lmpAction = (int)lcrBuffer.CurrentChar;
usleep(20);
Where this gets really sick is in these particular lines:
if (lcrBuffer.CurrentChar == 34)
LetQuotMarc(lcrBuffer, lmpAction);
if (lcrBuffer.CurrentChar == 39)
LetSingleQuotMarc(lcrBuffer, lmpAction);
Note that the guy clearly knows that you can treat a char as an int, but continues in the pointless code anyway.




I was thinking along the same lines.  Why not just use a switch statement if they're chars?

Re: Not Just Another RLB o'PCC

2005-10-28 14:54 • by rogthefrog
48633 in reply to 48625
Gene Wirchenko:
Anonymous:
It isn't just this massive list of mutually exclusive conditions, consider that someone actually wrote 95 different LetFooBar() functions also.




I doubt that is true.  Probably, one procedure was written 95 times.  Drool-cut-and-paste rules.



Sincerely,



Gene Wirchenko






My guess is that that "developer" has an XML template for the function
and runs a script to generate the actual code for all 95 or so. That
makes it very easy to add new functions as new ASCII codes are added to
the lower 127.



<charfunc>

  <char>_<char>

  <charname>underscore</charname>

  <funcbody>(brillant stuff goes here)</funcbody>

</charfunc>



This goes through a DOM parser that generates brillant code. SO MUCH TIME SAVED!

Re: Not Just Another RLB o'PCC

2005-10-28 14:57 • by Daniel T
48635 in reply to 48625
:-O

U



I must know - what do these Godforsaken Let... functions even do? 
After all, he's passing the entire string to each one (and an "action"
variable).



--Daniel T

Re: Not Just Another RLB o'PCC

2005-10-28 14:58 • by Totoro
48636 in reply to 48624
It has got to be computer made. While I am now fully convinced there
are people out there stupid enough to do this, the chance of finding
one with this amount of patience as well is next to none.

Re: Not Just Another RLB o'PCC

2005-10-28 14:58 • by Oscar Leeper

Just out of curiosity, has anyone ever seen code to generate this kind of nonsense, a la the following which could be used(roughly) to generate the {shudder} abomination above?


 


string someArray[][]


{


   {"&", "Ampers"},


   {"@", "at"},


   ...


   {" ", "Space"}


};


 


for(int i =0; i<128; i++)


   outputfile.WriteLine("if (lcrBuffer.CurrentChar=='"+someArray(0, i)+"')\n\tLet"+someArray(1, i)+"(lcrBuffer, lmpAction);\n");


 

Re: Not Just Another RLB o'PCC

2005-10-28 15:01 • by Barz

Excuse me while i go kill myself for seeing this travesty.

Re: Not Just Another RLB o'PCC

2005-10-28 15:08 • by RevMike
48640 in reply to 48625
Gene Wirchenko:
Anonymous:
It isn't just this massive list of mutually exclusive conditions, consider that someone actually wrote 95 different LetFooBar() functions also.




I doubt that is true.  Probably, one procedure was written 95 times.  Drool-cut-and-paste rules.



Sincerely,



Gene Wirchenko






Why even cut-and-paste?  Each of the LetFooBar functions is
actually #define macro that calls the same function with an extra
parameter.

Re: Not Just Another RLB o'PCC

2005-10-28 15:09 • by Anonymoose
48641 in reply to 48616
procyon112:
I also like how it's not even in ASCII order, or a switch statement, so
not only is each case tested for every case, but there's no hope for
the compiler to optimize it in the slightest.




That way, the function will have a very consistent execution time !?

Hey, it's O(1), without even resorting to 'caching'!





Re: Not Just Another RLB o'PCC

2005-10-28 15:11 • by frosty
48643 in reply to 48638
I know this is madness, but is there any chance we could see one of
these Let* functions?  I'm really curious how you can expand this
to 30 lines.



I mean, I know my head is hurting from the original post but hey, it's Friday.  My head can shut down in 4 hours.

Re: Not Just Another RLB o'PCC

2005-10-28 15:14 • by cm5400
48645 in reply to 48626

iAmNotACantalope:
This guy is my new hero.   I've decided that I will never use any class that contains less than 73 if statements.

In fact, I've decided that I won't do anything without includeing at least 2 if statments.


if( thisGuyIsStupid ) if( amIRight ) fufilledMyIfQuotaForThisPost();

pi


Should be:


 if( isTrue(thisGuyIsStupid) ) if( isTrue(amIRight) ) fufilledMyIfQuotaForThisPost();


[:P][:D][pi]

Re: Not Just Another RLB o'PCC

2005-10-28 15:19 • by Gene Wirchenko
48647 in reply to 48638
Anonymous:
Excuse me while i go kill myself for seeing this travesty.




No one forced you to come this site.  Now, suck in that gut and soldier!



Ah, the wonders of IT.  Not only do we have horrible code like --
you can fill this in -- but with Google Earth, you can probably find
the bridge that the code makes you jump off.



Sincerely,



Gene Wirchenko



Re: Not Just Another RLB o'PCC

2005-10-28 15:19 • by dubwai

Alex Papadimoulis:
I'll leave what those RLB o'PCC look like to your imagination ...


My imagination isn't working well.  Please post one of the implementations.  What is the point of all this?

Re: Not Just Another RLB o'PCC

2005-10-28 15:28 • by iAmNotACantalope
48649 in reply to 48645
cm5400:

iAmNotACantalope:
This guy is my new hero.   I've decided that I will never use any class that contains less than 73 if statements.

In fact, I've decided that I won't do anything without includeing at least 2 if statments.


if( thisGuyIsStupid ) if( amIRight ) fufilledMyIfQuotaForThisPost();

pi


Should be:


 if( isTrue(thisGuyIsStupid) ) if( isTrue(amIRight) ) fufilledMyIfQuotaForThisPost();


[:P][:D][pi]



Doh!

if( isTrue( rockIsHeavy) && isTrue( isTrue( isTrue( isTrue( isTrue( isTrue( ...... isTrue(  thisIsGettingOld  )  .... ))))))) hitProgrammerWithRock( isTrue( true ) );

Re: Not Just Another RLB o'PCC

2005-10-28 15:48 • by Meddler
48650 in reply to 48618
They'd at least be tolerable if they were pure acronyms (pronouncable)
and not just initialisms.  Like, uh, RELOBLOPOCOCO.  That's
much more fun to say!

Re: Not Just Another RLB o'PCC

2005-10-28 15:51 • by Meddler
48651 in reply to 48618
Gene Wirchenko:
Alex Papadimoulis:
RLB o'PCC (or for those not acronym
acquainted, Really Long Blocks of Pointless Conversion Code) are pretty
common place.


Please do not strain for acronyms.  It is undignified.  (See the rest of the IT industry for copious examples.)


95 ifs.  The cases include TAB and CR.  That means two displayable 7-bit ASCII characters got left out.


Sincerely,




Gene Wirchenko






And that last post was in response to this.  I sure do love preview buttons.

Re: Not Just Another RLB o'PCC

2005-10-28 16:06 • by Rank Amateur
48653 in reply to 48648
dubwai:

Alex Papadimoulis:
I'll leave what those RLB o'PCC look like to your imagination ...


My imagination isn't working well.  Please post one of the implementations.  What is the point of all this?



It can only be one thing:


void LetAmpers(String lcrBuf, int * lmpAct)
{
if (lcrBuf.Index(0).Char == '&')
    lmpAct[0] = 38;
if (lcrBuf.Index(1).Char == '&')
    lmpAct[1] = 38;


...and so on for a 30 character string.


--RA

Re: Not Just Another RLB o'PCC

2005-10-28 16:08 • by OneFactor
48654 in reply to 48649
iAmNotACantalope:
cm5400:

iAmNotACantalope:
This guy is my new hero.   I've decided that I will never use any class that contains less than 73 if statements.

In fact, I've decided that I won't do anything without includeing at least 2 if statments.


if( thisGuyIsStupid ) if( amIRight ) fufilledMyIfQuotaForThisPost();

pi


Should be:


 if( isTrue(thisGuyIsStupid) ) if( isTrue(amIRight) ) fufilledMyIfQuotaForThisPost();


[:P][:D][pi]




Doh!

if( isTrue( rockIsHeavy) && isTrue( isTrue( isTrue( isTrue( isTrue( isTrue( ...... isTrue(  thisIsGettingOld  )  .... ))))))) hitProgrammerWithRock( isTrue( true ) );


I personally prefer the for-switch paradigm myself. I was dazed for days by that one.

Re: Not Just Another RLB o'PCC

2005-10-28 16:12 • by Mung Kee
48655 in reply to 48650
Meddler:
They'd at least be tolerable if they were pure acronyms (pronouncable)
and not just initialisms.  Like, uh, RELOBLOPOCOCO.  That's
much more fun to say!




Oh, you mean pronouncable like "SQL?"

Re: Not Just Another RLB o'PCC

2005-10-28 16:22 • by ehabkost
48656 in reply to 48643
Anonymous:
I know this is madness, but is there any chance we could see one of
these Let* functions?  I'm really curious how you can expand this
to 30 lines.



I mean, I know my head is hurting from the original post but hey, it's Friday.  My head can shut down in 4 hours.




Me too. I am really curious to know *how* someone could make these Let*
functions be 30 lines long. My imagination isn't working well, too.

Re: Not Just Another RLB o'PCC

2005-10-28 16:22 • by Jeff S
48657 in reply to 48643

Anonymous:
I know this is madness, but is there any chance we could see one of these Let* functions?  I'm really curious how you can expand this to 30 lines.

I mean, I know my head is hurting from the original post but hey, it's Friday.  My head can shut down in 4 hours.


Yeah!  Post some of the Let() functions!  They seem like they might be useful, I could add them to my library ...  maybe they would come in handy for writing a keyboard driver or something ....

Re: Not Just Another RLB o'PCC

2005-10-28 16:23 • by Manni

Which type of post-whore are you?


There are several basic types of people who post on this board. Can you tell which one you are?


A) Catch-phraseologist: They take portions of previous posts and make inside joke references to them. The most frequently-seen of these are "brillant" and "IsTrue( )". Newcomers to the site are confused and try to correct these apparent errors, while the seasoned veteran readers don't find it at all amusing. Continued pathetic attempts at humor like this will be met with a stapler to the face.


B) Uber-geek: These argumentative assholes will write up a dissertation-sized response in which they go into detail about processor architecture and kernel operations, even if the WTF has to do with Javascript. They ignore the true nature of the problem originally posted, and prefer to engage in pointless debates with other uber-geeks. To these people, sex involves a keyboard, and no physical contact.


C) The one-liner: It's as simple as that, they post one line that gives no further insight or comedic value to what everyone else reads. It could be as simple as "W... T.... F!?!" Thank you for the affirmation that we are, in fact, viewing The Daily WTF. There was no point to your post, my life would have been better without it because I wouldn't have wasted 2 seconds reading your trite submission. Quite a few of these people are "Anonymous" posters because they are afraid that registering an account with their email address will cause satellites to beam communist thoughts into their brain via microwaves.


D) The optimizer: These geniuses quickly identify that the post of the day has logic flaws, spelling errors, or over-complex methods of performing simple tasks. As a way of showing off their programming skills, they re-write the post of the day to be the fastest and most stable piece of code known to man. If you printed their code out, you could take it to a bank becuase it's made of gold. Figure it out bonehead, the code was posted because it sucks. No one cares if you can write it better. It's especially fun when they "optimize" it in a different programming language, which makes the whole concept even less useful.


E) The "first" post: They like to be at the top of the list, with the fame and notoriety of having the very first response to every article. These people are also one-liners, because they never have anything else to say except "First!" These people are tard-monkeys, useless members of society who will most likely grow up to be politicians. 'Nuff said.


F) The whiner: They rarely have anything to contribute to the topic. Instead they complain about how people's conversations are going off on a huge tangent, and they try to find new and creative ways to insult those people like calling them names in different languages, or coming up with overly-descriptive lists of the types of people that piss them off. These people should be shot.

Re: Not Just Another RLB o'PCC

2005-10-28 16:24 • by Gene Wirchenko
48659 in reply to 48656
ehabkost:
Anonymous:
I know this is madness, but is there any chance we could see one of
these Let* functions?  I'm really curious how you can expand this
to 30 lines.



I mean, I know my head is hurting from the original post but hey, it's Friday.  My head can shut down in 4 hours.




Me too. I am really curious to know *how* someone could make these Let*
functions be 30 lines long. My imagination isn't working well, too.




It is a cluelessness, but it is a good cluelessness.  "Some things
man was not meant to know." (or however the quote goes.  BTW,
whose is it?)



Sincerely,



Gene Wirchenko



Re: Not Just Another RLB o'PCC

2005-10-28 16:25 • by BlackTigerX

[|-)]


I mean, sure this is a WTF, but isn't this too common?


the real question is, why wasn't my submission posted instead of this one?[:^)]

Re: Not Just Another RLB o'PCC

2005-10-28 16:28 • by BlackTigerX
48661 in reply to 48658
Manni:

Which type of post-whore are you?



I think you are the "hoax-whore" type[:D]

Re: Not Just Another RLB o'PCC

2005-10-28 16:29 • by Kiss me, I'm Polish
48662 in reply to 48655

Now, can anyone tell me why the code here is always with such tiny, unreadable fonts? huh? anyone? anyone?

Re: Not Just Another RLB o'PCC

2005-10-28 16:32 • by Gene Wirchenko
48664 in reply to 48658
Manni:
Which type of post-whore are you?

There are several basic types of people who post on this board. Can you tell which one you are?




You first.  Use your classification system, the one that seems to be missing anything not critical of others.


Sincerely,


Gene Wirchenko




Re: Not Just Another RLB o'PCC

2005-10-28 16:34 • by frosty
48665 in reply to 48658
Manni:

Which type of post-whore are you?


There are several basic types of people who post on this board. Can you tell which one you are?


A) Catch-phraseologist: They take portions of
previous posts and make inside joke references to them. The most
frequently-seen of these are "brillant" and "IsTrue( )". Newcomers
to the site are confused and try to correct these apparent errors,
while the seasoned veteran readers don't find it at all amusing.
Continued pathetic attempts at humor like this will be met with a
stapler to the face.


B) Uber-geek: These argumentative assholes will
write up a dissertation-sized response in which they go into detail
about processor architecture and kernel operations, even if the WTF has
to do with Javascript. They ignore the true nature of the
problem originally posted, and prefer to engage in
pointless debates with other uber-geeks. To these people, sex
involves a keyboard, and no physical contact.


C) The one-liner: It's as simple as that, they post
one line that gives no further insight or comedic value to what
everyone else reads. It could be as simple as "W... T.... F!?!" Thank
you for the affirmation that we are, in fact, viewing The Daily WTF.
There was no point to your post, my life would have been better without
it because I wouldn't have wasted 2 seconds reading your trite
submission. Quite a few of these people are "Anonymous" posters because
they are afraid that registering an account with their email address
will cause satellites to beam communist thoughts into their brain via
microwaves.


D) The optimizer: These geniuses quickly identify
that the post of the day has logic flaws, spelling errors, or
over-complex methods of performing simple tasks. As a way of showing
off their programming skills, they re-write the post of the day to be
the fastest and most stable piece of code known to man. If you printed
their code out, you could take it to a bank becuase it's made of gold.
Figure it out bonehead, the code was posted because it sucks. No one
cares if you can write it better. It's especially fun when they
"optimize" it in a different programming language, which makes the
whole concept even less useful.


E) The "first" post: They like to be at the top of
the list, with the fame and notoriety of having the very first response
to every article. These people are also one-liners, because they never
have anything else to say except "First!" These people are
tard-monkeys, useless members of society who will most likely grow up
to be politicians. 'Nuff said.


F) The whiner: They rarely have anything to
contribute to the topic. Instead they complain about how people's
conversations are going off on a huge tangent, and they try to find new
and creative ways to insult those people like calling them names in
different languages, or coming up with overly-descriptive lists of the
types of people that piss them off. These people should be shot.





Let me guess, you are an F) with a sprinkle of B).



(yes, I know this makes me a C)

Re: Not Just Another RLB o'PCC

2005-10-28 16:36 • by Hugo
48666 in reply to 48658
Manni:

There are several basic types of people who post on this board. Can you tell which one you are?



G) The wiseguy: They are positive that all readers of this site are only waiting for their smartass comment that the real WTF is actually ... (followed by a reference to the least offensive part of the daily WTF). Their comments usually start with "I got it! The WTF is ...". The message board software should be modified to automatically discard their messages and block their accounts.


Best, Hugo

Re: Not Just Another RLB o'PCC

2005-10-28 16:39 • by Manni
48668 in reply to 48658
Manni:

Which type of post-whore are you?



Wow, I thought I was a little more obvious. I intended myself to be an F. I apologize if I didn't make any derogatory statements about myself, I thought that the prospect of being shot was enough.

Re: Not Just Another RLB o'PCC

2005-10-28 16:48 • by ehabkost
48671 in reply to 48664
Gene Wirchenko:
Manni:
Which type of post-whore are you?

There are several basic types of people who post on this board. Can you tell which one you are?




You first.  Use your classification system, the one that seems to be missing anything not critical of others.





I think I will be rich if I start selling Sarcasm Detectors here. Anybody wants to join me on this business?

Re: Not Just Another RLB o'PCC

2005-10-28 16:48 • by Meddler
48672 in reply to 48655
Mung Kee:
Meddler:
They'd at least be tolerable if they were pure acronyms (pronouncable)
and not just initialisms.  Like, uh, RELOBLOPOCOCO.  That's
much more fun to say!




Oh, you mean pronouncable like "SQL?"




Some still insist on saying each letter instead of using the
established pronouncable acronym we all love.  It's interesting
how one pronunciation becomes preferable to another. We could be going
around saying "I love how easy it is to install my squall in windows."
  And sometimes the word doesn't quite fit - around here people
say NMEA (a type of GPS signal) as "nee-ma" as if it's NEMA.

Re: Not Just Another RLB o'PCC

2005-10-28 16:50 • by dubwai
48674 in reply to 48668
Manni:
Manni:

Which type of post-whore are you?



Wow, I thought I was a little more obvious. I intended myself to be an F. I apologize if I didn't make any derogatory statements about myself, I thought that the prospect of being shot was enough.



What about the people who explain why it's not a WTF?  I didn't see that category.  Basically a pretty good list, though.

« PrevPage 1 | Page 2 | Page 3Next »

Add Comment