|
I remember there used to be a thread like this, but I can't find it anymore. Just post code that either you or your coworkers/classmates have written that is hilariously bad. I've been looking through a large system recently, since I just started a new co-op and I have to get caught up. This one coder (who I've never met) has stuff like this in all his classes: private static final int FIVE = 5; private static final int NEG_ONE = -1; private static final int FIVE_BILLION = 5000000000; private static final String SPACE_PIPE_EQUALS = " |="; private static final String ERROR_WITH_CODE = "Error with code"; I was reading one of his classes today that had 50 lines of constants written like that. In an 800 line class. Also, in multiple places he does this: File fw = new File(args[0]); File fh = new File(args[1]); File nv = new File(args[2]); File nh = new File(args[THREE]); File tw = new File(args[FOUR]); He does this in multiple classes. 0, 1, 2 are fine, but any number higher than that he replaces with a named constant. He also doesn't comment his code, and uses method names like "task" and "task2". Then there was this method: code:
I'm sure compared to many of you that this isn't all that bad, so share your own tale of horror!
|
# ¿ Mar 21, 2008 00:33 |
|
|
# ¿ Apr 30, 2024 06:18 |
|
CeciPipePasPipe posted:How come the guy is still employed? My guess is that he is/was a co-op. They were apparently rather excited to hire me, and all I did was answer some pretty basic questions on OOP (not saying this to brag, because I am not that good of a programmer), so they probably don't have the most talented pool to choose from. Hell, they're hiring from my school, I know they don't have that talented a pool to choose from. When I mentioned the lovely naming to the senior developer, he said he had not seen it, so probably no one really noticed.
|
# ¿ Mar 21, 2008 01:14 |
|
dwazegek posted:
No. Strings are immutable, so any changes made inside the method don't apply to result anymore. Never mind the fact that result will never equal "worked" since they will never point to the same object, and he should have used .equals.
|
# ¿ Mar 23, 2008 02:24 |
|
This was really awesome.code:
code:
|
# ¿ May 14, 2008 01:16 |
|
code:
code:
|
# ¿ Jun 23, 2011 03:26 |
|
|
# ¿ Apr 30, 2024 06:18 |
|
Java code, everything is a booleancode:
code:
|
# ¿ Jun 28, 2013 02:25 |