The following links may help navigating this page
No Feed Found

Piccolo Quiz - Bad Code I · 2006-10-02

There was not enough code posting here lately. This needs to be changed. So today I start a little series on bad code. Here is the first piece. It does something until number equals limit and returns times_done_something:

public int doSomethingUpTo(int number, int limit){
int iterations = 0;
boolean done = false;

       if(number+iterations == limit)
             done = true;

return iterations;

Question: Why is this code bad? Be the first who gives the right answer and win a Rotkaeppchen Piccolo. Do not post the answer to the comments. You'd rather mail it.

Update 22:16 CEST: Obviously I'm not the only one featuring bad code lately. Kevin Poulsen posts bad code at Over at wired you can win democracy instead of cheap champagne which is quite a big thing to win. Do not miss the comments over there.

Commenting is closed for this article.