Geeks With Blogs
INETA Pakistan Blogs Home of INETA Geeks
I read this post at the dail wtf(http://www.thedailywtf.com/). 
And I couldnt resist my temptation to share it with you all.... Its just awesome.

-- begin Horror.java  ---
/**
 * All code include in this class is REAL!
 */
public class Horror {

 public boolean compareObjects(Object obj1 , Object obj2) {
  if (obj1.equals(obj2) == true)
   return true;
  else
   return false;
 }
 
 public horribleBreakingLoops() {
  try {
   for (int i = 0; i < 100; i++) {
    if (i == 98) {
     // Yes, java does have 'break' to exit loops
     throw new Exception();
    }
   }
  } catch (Exception e) {}
 }

 public stringsHorror(String lastName) {
  if (lastName.charAt(0) == new String("*").charAt(0)
    || lastName.charAt(0) == new String("%").charAt(0)) {
   // here goes the code ;)
  }
 }
 
 protected int myHorrorIndex = new Integer("1").intValue();
  
 public long fearOfCastingHorror() {
  return System.currentTimeMillis() + new Double(Math.random()).longValue();
  //instead of return System.currentTimeMillis() + (long)Math.random();
 }
 
  /**
   * Does something
   *
   * @return Nothing
   */
  public void imTooBusyToAddJavadoc() {
  /**
   * The method 'imTooBusyToAddJavadoc' was written by my former subordinate. 
   * His code was comment-free, so I asked him to document his code with 
   * javadoc, which is used to build documentation of the class library. 
   * Obviously he added too-much javadoc ;)
   * /
  }
  
  public boolean checkIsNull(Object a) {
    if( !a.equals(null) ) {
      /// it's really kilin' me ;)
    }
  }
  
  int getHttpPort() throws IllegalArgumentException {
    /// and which is the illegal argument?
  }
}
-- end Horror.java  ---

Hammad Rajjoub,
User Group Leader - Dot Net Wizards (http://dotnetwizards.blogspot.com),
Chariman UG Relations Committee (http://inetapakistan.org),
Member Speakers Bureau (http://mea.ineta.org)
Posted on Monday, March 21, 2005 4:53 PM | Back to top


Comments on this post: awesome code snippet at Daily WTF

# re: awesome code snippet at Daily WTF
Requesting Gravatar...
Yup...I'm totally scared...more eerie than Carrie (both 1976 & 2002)

The best one is

if (lastName.charAt(0) == new String("*").charAt(0)
|| lastName.charAt(0) == new String("%").charAt(0)) {

sneer: nice attempt to make spaghetti of a language
Left by Adnan Masood on Mar 22, 2005 12:27 PM

Your comment:
 (will show your gravatar)


Copyright © INETA Pakistan | Powered by: GeeksWithBlogs.net