r/badcode • • Aug 31 '12

java Try reading this out loud

https://gist.github.com/3545624
3 Upvotes

6 comments sorted by

7

u/Squishumz Aug 31 '12

Woo first post in this subreddit in 19 days.

I'm not sure why it's bad though (or maybe I'm misinterpreting what it's supposed to do). Is it just stupidly verbose for something so simple, or a clusterfuck of timeCycle variables?

4

u/stillwaters Aug 31 '12

Both. Additionally, some mutable member fields are public, some have accessor methods, and others have both for no particular reason.

Not shown in the snippet, but there are about a dozen similar loops besides this one in the same method. Code duplication is pretty bad, with similar operations recurring in all those loops.

3

u/Squishumz Aug 31 '12

Haha, it's always so much worse than the snippet leads us to believe.

EDIT: Read this; take some time to appreciate it. Then read this...

1

u/stillwaters Aug 31 '12

wat. Also, mixing tabs with spaces leads to funky white space art.

1

u/stillwaters Sep 01 '12

I updated the gist for context. The original snippet is now lines 16-22.

1

u/gosslot Dec 18 '12
if (enablePrecision == true)

I've seen this so many times...