Great stuff unmaintainable code – ROFL
Just some quotes from it :
- Refactoring is a most emotionally-satisfying activity. It is second only to sex. Your own inchoate intention suddenly shines through with blinding clarity. You must restrain the impulse.
- Too Much Of A Good Thing(TM): Go wild with encapsulation and OO. For example:
myPanel.add( getMyButton() );
private JButton getMyButton()
{
return myButton;
}
That one probably did not even seem funny. Don’t worry. It will some day.
- The XML fad has created a bonanza of opportunities for obfuscation. The basic technique is to pick a random hunk of code, then invent an obscure way of representing its logic in XML. Then replace the piece of code with an XML properties file and an XML parser. Make sure the XML representation you choose is so limited that almost anything other than the original logic cannot be expressed in it. Of course you never document the XML language extension or the parser. Nobody questions the simplicity of XML. Using this technique, you should easily be able to balloon 10 lines of simple Java code up to 100 lines of perfectly opaque XML.
- Nest as deeply as you can. Good coders can get up to 10 levels of ( ) on a single line and 20 { } in a single method. C++ coders have the additional powerful option of preprocessor nesting totally independent of the nest structure of the underlying code. You earn extra Brownie points whenever the beginning and end of a block appear on separate pages in a printed listing. Wherever possible, convert nested ifs into nested [? : ] ternaries. If they span several lines, so much the better.
Fred says:
Came here looking for an answer to why the getMyButton() snippet could be funny? I don’t do a lot of Java, is it some sort of in-joke? -F
[Reply]
January 27, 2012, 3:13 pm