• (cs) in reply to Lacrymology
    Lacrymology:
    I can't fail to notice the awful amount of WTFs that are submitted that are either in Java, VB, and ASP.
    There's been a lot of code written in those languages. Some of that was done by people who are in this business just to make money for themselves, and not to actually do their jobs well. (Such people are more likely to be found using common languages.) So it's not surprising that there is ill-conceived and ill-implemented code out there in those languages; such code is the basis for much of the articles on this site.

    Remember, you don't want to read about something that's working nicely in deployment with no trouble and which it is easy to update. And there's not likely to be many stories about the use of something really obscure like Malbolge in production because there's nobody doing that.

  • (cs) in reply to someguest_5342809
    someguest_5342809:
    Why is this a WTF? Looks like reasonable memory allocation and/or garbage collection testing. As long as it is indeed dead code, and not run on each call to some often-called function...
    "Hey, you know that function that kept thrashing the garbage collector? I've found a way to halve how much it allocates!"
  • Crisw (unregistered) in reply to Lacrymology
    Lacrymology:
    I can't fail to notice the awful amount of WTFs that are submitted that are either in Java, VB, and ASP.

    Maybe if people would stick to real programming languages for their projects, the shitty wannabies would stay out of their companies, and they'd actually save some money or, at the very least, headaches.

    For the record, a "real" programming language would be C/C++ for low-level / time critical requirements and python for high-level / non-critical applications ;)

    Anyone that can't write quality code in a Turing complete language isn't a real programmer.

  • Public menace (unregistered) in reply to Lacrymology
    Lacrymology:
    I can't fail to notice the awful amount of WTFs that are submitted that are either in Java, VB, and ASP.

    Maybe if people would stick to real programming languages for their projects, the shitty wannabies would stay out of their companies, and they'd actually save some money or, at the very least, headaches.

    --snip--

    Java gets its new lambda syntax next year - perhaps an intensive campaign to use it as often as humanly possible would steepen the learning curve a bit? :-)
  • jarfil (unregistered) in reply to Crisw
    Crisw:
    Lacrymology:
    I can't fail to notice the awful amount of WTFs that are submitted that are either in Java, VB, and ASP.

    Maybe if people would stick to real programming languages for their projects, the shitty wannabies would stay out of their companies, and they'd actually save some money or, at the very least, headaches.

    For the record, a "real" programming language would be C/C++ for low-level / time critical requirements and python for high-level / non-critical applications ;)

    Anyone that can't write quality code in a Turing complete language isn't a real programmer.

    ^^ This.

    I used to write better code in BASIC when I was 12, than some people do today in C/C++. No language choice will fix a bad programmer.

  • Err...? (unregistered) in reply to Gibbon1
    Gibbon1:
    Python had the problem a lot of scripting languages have, no installer. So nontechnical people can't use the program without hand holding.
    1. Python has an installer (in fact, it's had a Windows installer for quite a while, and on Linux, it's universally available from w/e package manager you are using)
    2. Besides that, you have tools like Freeze and py2exe that make it possible to create a self-contained executable from a Python program.
    3. Distutils itself also provides support (bdist_wininst or bdist_msi) for creating installers for Python packages
  • Peter Lawrey (unregistered)

    If you want to produce a reasonably predictable amount of garbage

    new byte[bytesOfGarbage];
    

    This produces slightly more with overhead. ;)

  • linepro (unregistered) in reply to Peter Lawrey
    Peter Lawrey:
    If you want to produce a reasonably predictable amount of garbage
    new byte[bytesOfGarbage];
    
    This produces slightly more with overhead. ;)

    Yes but it won't keep the CPU warm.

  • AC (unregistered)

    I guess no one of you has ever written something like this, because then you would know that:

    • the wait() is there so you can attach a debugger to this little test program

    • the "o" should not get optimized away so you have something to inspect in the debugger.

    While most of the stuff in that class obviously was left over from copy/pasting, the main() method is not bad at all. And if you really look close, you would see that almost no "wtfy" code actually gets used when you run that class.

    I keep wondering why so many people feel the need to post such code to tdwtf, when they obviously have no idea about programming themselves. The only fault of the guy writing the main() method was, that he left a lot of dead code in there.

  • DawgBoy (unregistered)

    Much easier if done in Perl: @P=split//,".URRUU\c8R";@d=split//,"\nrWTFekcah xinU / lreP rehtona tsuJ";sub p{@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord($p{$})&6];$p{$}=/ ^$P/ix?$P:close$}keys%p}p;p;p;p;p;map{$p{$}=~/^[P.]/&&close$}%p;wait until$?;map{/^r/&&<$>}%p;$_=$d[$q];sleep rand(2)if/S/;printwhile{($s,$m,$h)=localtime(); if(length($h)==1){$h="0".$h}h;$r=$h;$h1=s+ubstr($h,0,1); $h2=substr($h,1,1);if (length($m) == 1){$m="0".$m} $w=$m; $t=$m; $m1=s+ubstr($m,0,1);$m2=substr($m,1,1); if (length($s) == 1) {$s="0".$s} $e=$s;$y=$s;$s1=s+ubstr($s,0,1); $s2=substr($s,1,1);while ($h1>0) { if ($h1 %2 == 0) { $str1.=0; } else+ { $str1.=1; } $h1=int($h1/2);} $str1.="0" while length($str1)<4;$str1=reverse$str1)+;while ($m1>0) { if ($m1%2 == 0) { tr2 .= ; } else { $str2.=1; } $m1 = int($m1/2);+ } $str2.= "0" e ength($str2) < 4; $str2 = reverse($str2); while ($s1>0) { if (+$s1 % 2 == 0){$str3.=0;} else {$str3.=1;} $s1=int($s1/2); } $str3 .= "0" while leng+th($str3) < 4; $str3=reverse$str3);while ($h2>0) { if ($h2 %2 == 0){$str4.=0; } else+ {$str4.= 1; } $h2 = int($h2/2); } $str4 .= "0" while length($str4) < 4; $str4 = r+everse($str4); while ($m2>0) { if ($m2 % 2 == 0){ $str5 .= ; } else { $str5.=1; }$m2+=int($m2/2); } $str5 .= "0" while length($str5) < 4; $str5 = reverse($str5); while ($s2>0) { if ($s2%2 == 0){ $str6 .= 0;} else {$str6 .= 1; } $s2= int($s2/2); } $str+6 .= "0" whilelength($str6) < 4;$str6=reverse($str6);while($q>0){ if ($q % 2 == 0) {+ $str7 .= 0; }else { $str7 .= 1; } $q = int($q/2); } $str7 .= "0" while length($str7 +) < 6; $str7 = reverse($str7); while ($w>0){ if ($w % 2 == 0){ $str8 .= 0; } else{ $s+tr8 .= 1; }$w=int($w/2);} $str8.="0" hile length($str8) < 6; $str8=reverse($str8); +while ($e>0) {if ($e % 2 == 0) { $str9 .= 0; } else { $str9 .= 1; } $e = nt$e/2); +} $str9 .= "0"while length($str9) < 6; $str9 = everse$str9); @x1 = split//,$str1; +@x2 = split//,$str4; @x3 = split// ,$str2; @x4 = split//, $str5; @x5 = plit//,+ $str3; @x6 =split//, $str6; @x7 = split//, $str7; x8 = split//, $str8; @x9 = s+plit// ,$str9;print "\n\n\n x20] $x4[0] $x6[0] \n $x2[1] $x3[1] $x4[1] $x+5[1] x61]" ;print "\n $x1[2] $x2[2] $x3[2] $x4[2] $x5[2] $x6[2] \n $x1[3] x23] $+x3[3] $x4[3]";print " $x5[3] $x6[3] \n\n\n\n\n @x7\n @x8\n x9\n\n\n\n\n $r:$t:$y\n+n\n"; sleep 1;( $str1, $str2, str3, $str4, $str5, $str6, $str7, $str8, str+9 ) ""; }

  • AGray (unregistered)

    Love the null reference exception I see coming from function generateRubbish...

  • ClaudeSuck.de (unregistered) in reply to lolwtf
    lolwtf:
    So, a memory allocator/garbage collector stress tester. OK? I guess finding it necessary could be a WTF...

    Unless you have to program the GC

  • Uncle Al (unregistered) in reply to ClaudeSuck.de
    ClaudeSuck.de:
    lolwtf:
    So, a memory allocator/garbage collector stress tester. OK? I guess finding it necessary could be a WTF...

    Unless you have to program the GC

    ...as commonly occurs when writing code for embedded systems. (Sorry, but someone had to say it. :-) )

  • Jay (unregistered) in reply to nick
    nick:
    Not knowing what code is for does not mean it is bad code

    Hey, I know plenty of people who hate anything they don't udnerstand.

  • Jay (unregistered) in reply to Quicksilver
    Quicksilver:
    in my experience "never" is a synonym for almost always when you don't expect it. e.g. after the next JVM upgrade suddenly your incorrect code no longer works.

    Somewhere or other I read a discussion of how it can sometimes be difficult to reproduce an error because the circumstances involved may not be apparent. And then the writer concluded, "Sometimes the only way to reliably reproduce an error is to give a demo for an important customer."

    Quicksilver:
    One of the worst pitfalls of Java... incorrect code may work correctly if you are on the right jvm.

    Well, sure. Just like in a compiled language, incorrect code may work correctly if you use the right compiler or the right version of the compiler.

    I've written plenty of C programs that worked fine when compiled on Windows but didn't work when compiled on Linux, etc etc.

    Frankly I think this sort of incompatiblity is much less of a problem in Java than in compiled languages, because the developers of Java put a lot of effort into cross-platform compatibility.

  • n (unregistered) in reply to barnstormer

    No, gblx=Goblex, cousin of goblin

    captcha: augue - cousin of queue

  • Gibbon1 (unregistered) in reply to Jay
    Jay:
    Well, sure. Just like in a compiled language, incorrect code may work correctly if you use the right compiler or the right version of the compiler.

    Frankly I think this sort of incompatiblity is much less of a problem in Java than in compiled languages, because the developers of Java put a lot of effort into cross-platform compatibility.

    The difference is that when C/C++ code breaks on a new compiler, there is a developer in front of the terminal, grumbling at the result. When a Java program breaks because the 'wrong' version of Java is installed, it's some poor sap end user.

  • aaaa (unregistered) in reply to DawgBoy
    DawgBoy:
    Much easier if done in Perl: @P=split//,".URRUU\c8R";@d=split//,"\nrWTFekcah xinU / lreP rehtona tsuJ"; .......
    Give credit where it's due, you dawgmongler:

    http://perl.plover.com/obfuscated/


    Screw you, Akismet. No linked URL, then.

  • eric (unregistered) in reply to bart
    bart:
    Lacrymology:
    Maybe if people would stick to real programming languages for their projects, the shitty wannabies would stay out of their companies, and they'd actually save some money or, at the very least, headaches.

    Anyone making such a statement shouldn't be in the development world themselves. Such a bold and black and white statement is just assinine.

    I completely agree. I've seen horrible things done in "real" programming languages, like C++, and beautiful, concise, eloquent things done in VB.

  • Tim Rowe (unregistered) in reply to Lacrymology
    Lacrymology:
    I can't fail to notice the awful amount of WTFs that are submitted that are either in Java, VB, and ASP.
    Well, Intercal would be like shooting fish in a barrel...
  • L. (unregistered) in reply to Jay
    Jay:
    Quicksilver:
    in my experience "never" is a synonym for almost always when you don't expect it. e.g. after the next JVM upgrade suddenly your incorrect code no longer works.

    Somewhere or other I read a discussion of how it can sometimes be difficult to reproduce an error because the circumstances involved may not be apparent. And then the writer concluded, "Sometimes the only way to reliably reproduce an error is to give a demo for an important customer."

    Quicksilver:
    One of the worst pitfalls of Java... incorrect code may work correctly if you are on the right jvm.

    Well, sure. Just like in a compiled language, incorrect code may work correctly if you use the right compiler or the right version of the compiler.

    I've written plenty of C programs that worked fine when compiled on Windows but didn't work when compiled on Linux, etc etc.

    Frankly I think this sort of incompatiblity is much less of a problem in Java than in compiled languages, because the developers of Java put a lot of effort into cross-platform compatibility.

    Frankly I think nobody gives a shit, since we're in 2012 and 99.9% of the software produced today is web-based, and noone in their right mind would consider something else than c/c++ on *nix as backend.

    blabla cross-platform gheyness is done for, nobody needs the "w/e for android" when it's available in web-based.

Leave a comment on “The RubbishGenerator”

Log In or post as a guest

Replying to comment #:

« Return to Article