The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: What Was The Programmer Thinking?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Friday Java Quiz: What Was The Programmer Thinking? Posted: Aug 28, 2009 7:13 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Friday Java Quiz: What Was The Programmer Thinking?
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

It's been a while since I last posted a blog entry here (or tweeted over there, for that matter). It mostly have to do with the new schedule I'm trying to maintain with a new client. I use to go to work at 8:45am and arrive at 9:00am. Now I start a 7:50am and arrive at 8:20am. I didn't realize how important that fifty minutes of early morning time is to this blog. The lack of blog entries is definitely *not* the effect of the Java 1.4 on IE 6 corporate standard programming environment. Although the "we are going to yank the Firefox that you installed on our PC (that you are using)" email people get from time to time are a little bit ...[the author redacted five words here].

Today's quiz is a gem that Michael showed me yesterday. It's part of a huge class that compiles, runs without exceptions, and has been in production for a while. So today's question is not along that line. Instead, I ask you to figure out:

Q: What was the programmer thinking? (The code has been hand-obfuscated to remove any hint of the domain model.)

public boolean isXXXXAllowed() {
  boolean rc = false;
  Iterator it = getYYYYList().iterator();

  do {
    if (it.hasNext()) {
      YYYYInfo aTemp = null;
      try {
        aTemp = (YYYYInfo) it.next();
      } catch (NoSuchElementException e) {
        try {
          aTemp = (YYYYInfo) it.next();
        } catch (NoSuchElementException e2) {
          LOGGER.debug("huh");
        }
      }

      if (aTemp.isXXXXAllowed()) {
        rc = true;
        break;
      }
    }
  } while (it.hasNext());
  return (rc);
}

Read: Friday Java Quiz: What Was The Programmer Thinking?

Topic: Disappointment(s) with Facebook API Previous Topic   Next Topic Topic: Copier Heads

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use