• frist commentor (unregistered)

    Frist! Askimet! I say Frist!

  • Wheaties (unregistered)

    Is this some sort of nebulous testing class designed like the evil monkey of distributed systems?

  • enterprise this (unregistered)

    Oh...My...Deity.

  • (cs)

    Must be British code. If it was American it would have used Trash.

  • allinflames (unregistered)

    What's so mysterious about this class?

    Based on the comments, seems like it's a predictable memory allocation utility, likely to test load on a JVM.

  • Mike Caron (unregistered)

    This code is rubbish.

  • (cs)

    Garbage In Garbage Out?

  • jMerliN (unregistered) in reply to Nagesh
    Nagesh:
    Garbage In Garbage Out?

    Rubbish in Rubbish out, more precisely.

  • Dan (unregistered)

    Shouldn't the non-Javadoc comments also be anonymized?

  • nick (unregistered)

    Not knowing what code is for does not mean it is bad code

  • Adam (unregistered)

    Can you please post the code for the RubbishCollector?

  • (cs)

    0.0

    No, Akismet, this is not spam...

  • barnstormer (unregistered)

    gblx == Global Crossing?

  • Jonathan (unregistered) in reply to jMerliN

    Rubbish Under Heap, Rubbish Over Heap. RUH-ROH.

    captcha: dolor - already a valid and quite suitable English word, thank you

  • (cs) in reply to allinflames
    allinflames:
    What's so mysterious about this class?

    Based on the comments, seems like it's a predictable memory allocation utility, likely to test load on a JVM.

    I came here to post pretty much this. It looks quite strongly like it's designed to allocate a lot of memory as part of some sort of test.

  • Frz (unregistered)

    A utility for testing garbage collection of the jvm might be useful in some circumstances. This one certaintly isn't.

    I especially like how

    • Atomic-Types and synchronized blocks are used together for extra thread safety (you can never be sure with those threads!)
    • The setter do a check first if they'd set anything (note: this might actually be useful if not for the synchronized block)
    • The setters do sanity checks inside the synchronized blocks (again: those threads are unpredictable!)
    • main synchronizes on a local RubbishGenerator instance then calls wait without a chance for notify to be called.
  • Quicksilver (unregistered)

    My guess on the code would be that its a class for testing the actual size of objects.

    so why is it here ... seems perfectly reasonable... not even the naming is that bad for just being some "run once" code not meant for production but just to get some knoledge about Java.

  • Quicksilver (unregistered) in reply to Frz
    Frz:
    - main synchronizes on a local RubbishGenerator instance then calls wait without a chance for notify to be called.

    Java has spurious wakeups so the wait call has a chance to return before the time runs out...yet I presume that waiting forever was the intention of the code.

  • DGM (unregistered)

    <quote>"most of the time, it's different versions (sometimes older, sometimes newer) of the same class that were created as part of a good-intentioned refactoring that was never quite completed."</quote>

    That indicates a failure to understand feature branches in scm.... Seems like I can tell good work from bad work simply by their understanding of scm.

  • Frz (unregistered) in reply to Quicksilver
    Quicksilver:
    Java has spurious wakeups so the wait call has a chance to return before the time runs out...yet I presume that waiting forever was the intention of the code.
    Yes java does have that but it "never" happens in reality on x86. So yes you are probably right that the intention was to halt execution for the time specified (~16minutes) - which would also explain the synchronized block as it is required. Maybe Object.wait was just more obvious than Thread.sleep
  • (cs) in reply to Anketam
    Anketam:
    Must be British code. If it was American it would have used Trash.

    Must be.

    (And kiss my ar**, A-kiss-me-too. Plus, the RWTF is that I looked up the meaning of word 'kismet', just for the curiosity. 'Fate', how does that describe a spam filter?)

  • Myth (unregistered) in reply to Synchronos
    Synchronos:
    Anketam:
    Must be British code. If it was American it would have used Trash.

    Must be.

    (And kiss my ar**, A-kiss-me-too. Plus, the RWTF is that I looked up the meaning of word 'kismet', just for the curiosity. 'Fate', how does that describe a spam filter?)

    It decides the fate of your comment: published or not.

  • (cs)

    This is the most amazing Rubbish I've ever seen. Probably the best part of all is that one lone comment in there:

    // so its not optimized away

    That about says it all, with respect to what this thing does.

    No wonder the author name was left blank.

  • adam (unregistered)

    TRWTF is that they actually made a rubbish generator interface.

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

    you must be new around here

  • Hans (unregistered)

    The real WTF is the "com.initech" at the beginning when it is clear from the rest of the code, that it actually belongs to gblx.com :-)

  • Lacrymology (unregistered)

    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 ;)

  • Hmmmm (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 ;)

    Far too obvious. 1/10

  • YF (unregistered) in reply to Lacrymology
    Lacrymology:
    python for high-level / non-critical applications ;)
    Good programmers are rare nowadays... high-level applications are needed everywhere, and a scripted language that allows powerful/dangerous things (just remembered PHP's variable variables now) does not look like a helping hand.

    The only reason I agree that a C/C++/python app may come out better is that less new coders know them, therefore they have a distinct average coder skill.

  • bart (unregistered) in reply to Lacrymology
    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.

  • (cs) in reply to Synchronos
    Synchronos:
    (And kiss my ar**, A-kiss-me-too. Plus, the RWTF is that I looked up the meaning of word 'kismet', just for the curiosity. 'Fate', how does that describe a spam filter?)

    Anagram of "mistake".

    Or "meat ski".

  • (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.

    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 ;)

    Oh just fuck off and die, puke-brain.

  • AN AMAZING CODER (unregistered)

    TRWTF is still not having some sort of code formatting on this site.

  • Rosuav (unregistered)

    Yes, it's obviously a testing class (probably, as other comments have posted, for the memory allocator or related). But why so much code? Why not just declare an array, stuff X random strings into it, and save it in some global (or pseudo-global, this being Java) location so it doesn't get GC'd?

  • John (unregistered)

    This code would never work in NET! We have garbage collection.

  • wllmsaccnt (unregistered)

    I would have to agree with the earlier comment that this is just garbage collection load testing code. It very specifically is creating chained object references so that the garbage collector will have to do some work.

    The code looks sloppy and isn't very self documenting...but it looks like single purpose relatively throw-away code. I'm guessing they used it at one point while testing various architecture options and never looked back.

  • Lazy (unregistered)

    tl;dr

  • Tractor (unregistered) in reply to Jonathan
    Jonathan:
    captcha: dolor - already a valid and quite suitable English word, thank you

    dolor sit amet

  • ih8u (unregistered) in reply to YF
    YF:
    Lacrymology:
    python for high-level / non-critical applications ;)
    Good programmers are rare nowadays... high-level applications are needed everywhere, and a scripted language that allows powerful/dangerous things (just remembered PHP's variable variables now) does not look like a helping hand.

    The only reason I agree that a C/C++/python app may come out better is that less new coders know them, therefore they have a distinct average coder skill.

    I read the original thinking "too obvious a troll". I was wrong.

  • Hmmmm (unregistered) in reply to Lazy
    Lazy:
    tl;dr

    Lazy? Or maybe...?

    (I wish aksimet was lazy)

  • Anon (unregistered)
    R.S.:
    "We have a bit of a dead code problem," writes R.S., "most of the time, it's different versions (sometimes older, sometimes newer) of the same class that were created as part of a good-intentioned refactoring that was never quite completed."

    My hypothesis is that R.S.'s place may have issues with code being reused in programs where they are not intended to be used. He may have finally tracked down the origination of the code that caused those TPS reports to run so ungodly long.

  • Dirk (unregistered)

    So, what does it do?

  • someguest_5342809 (unregistered)

    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...

  • Quicksilver (unregistered) in reply to Frz
    Frz:
    Quicksilver:
    Java has spurious wakeups so the wait call has a chance to return before the time runs out...yet I presume that waiting forever was the intention of the code.
    Yes java does have that but it "never" happens in reality on x86....snip
    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. One of the worst pitfalls of Java... incorrect code may work correctly if you are on the right jvm.
  • (cs)

    So, a memory allocator/garbage collector stress tester. OK? I guess finding it necessary could be a WTF...

  • Shinobu (unregistered) in reply to Quicksilver
    Quicksilver:
    One of the worst pitfalls of Java... incorrect code may work correctly if you are on the right jvm.
    This is not a pitfall of Java. If your code must run on multiple machines you can run into this. Just to give a few examples: [*]Code that assumes the documents folder is called ‘D:\My documents’. [*]Code calling Win32 functions that relies on an undocumented side effect that is different between XP and 2K. [*]JavaScript code on different browsers. [*]Code calling LibIntl that doesn't set/clear the LANGUAGE environment variable. [*]Manually drawn / hardwired UI that looks ugly when a different skin is used. And so on and so forth. If you're relying on undocumented behaviour you will run into issues, and it doesn't matter whether you're using Java/Dotnet/Win32/Posix/...
  • Gibbon1 (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 ;)

    Not sure if trolling.

    Well a language that allows sloppy or inexperienced people to produce useful work isn't without advantage. Also vast numbers of programs are written in Java and VB so there is a lot of fodder and most of it is boring enterprise sh't the no one cares about. Vs for sale proprietary software where if management finds out you disclosed code to an outsider without an NDA, you'll get the frog march.

    You can only get away with programming C when you have hard resource constraints. C++ when you need speed and your user base is large. Python had the problem a lot of scripting languages have, no installer. So nontechnical people can't use the program without hand holding.

  • TheJonB (unregistered)

    Our MIS system is like that, well, except it just churns out shit of course.

  • Philipp (unregistered)

    I don't see what's so bad about that code.

    OK, it looks a bit over-engineered for what it seems to be supposed to do, but most Java code looks overengineered to me at first glance.

  • The Pure British (unregistered) in reply to Anketam
    Anketam:
    Must be British code. If it was American it would have used Trash.

    Hang on laddie, what are you saying?

Leave a comment on “The RubbishGenerator”

Log In or post as a guest

Replying to comment #:

« Return to Article