Live data from Hacker News

Anyone who looks at this code instantly becomes insane

github.com

11–20 of 81 posts

Re: Anyone who looks at this code instantly becomes insane

#11
I've seen different kinds of comparably atrocious over the years.

This is at least obvious and easy to explain badness... And the lesson was learned. Some people don't learn it or are forced to ignore it all the time by middle management.

(This is how you go grey haired from stress.)

Re: Anyone who looks at this code instantly becomes insane

#12
post #10
post #5

https://github.com/raxod502/TerrariaClone/blob/master/src/Te... You may not like it, but this is peak programming. A level of perfection attainable only by undergoing the rite of writing a single if statement with 100+ conditions.

No, this is peak coding. A coder strives to write the longest and most impressive code. A programmer strives to write the code that solvers the problem at hand at the simplest and most reliable way.

"You may not like it, but this is peak X" is an internet meme, usually sarcastic in nature.

Re: Anyone who looks at this code instantly becomes insane

#14
Honestly the only insane thing is that it's all in one file. Could've also been broken up into more functions (it seems like this person didn't actually want to be using Java), but it's reasonably named and formatted and they did a decent job separating out static data at the top instead of littering it throughout the code.

Oh, and that stream of comments by polytomous. That's... something.

Re: Anyone who looks at this code instantly becomes insane

#15
post #10

Earlier quoted context omitted.

No, this is peak coding. A coder strives to write the longest and most impressive code. A programmer strives to write the code that solvers the problem at hand at the simplest and most reliable way.

"You may not like it, but this is peak X" is an internet meme, usually sarcastic in nature.

It feels like this may have been "peak bikeshedding"...

Certainly, a great meme to use but also indicative of the divisive nature of some discussions, often without any sarcasm.

Re: Anyone who looks at this code instantly becomes insane

#16
post #14

Honestly the only insane thing is that it's all in one file. Could've also been broken up into more functions (it seems like this person didn't actually want to be using Java), but it's reasonably named and formatted and they did a decent job separating out static data at the top instead of littering it throughout the code. Oh, and that stream of comments by polytomous. That's... something.

This kind of thing in particular is really interesting:

  public static void print(String text) {
    System.out.println(text);
  }
This person cares enough about brevity to make little wrapper functions like this, but at the same time everything is very procedural and monolithic. This gives a vague, weird sense of refined taste, despite some obvious problems with the artifact as a whole.

I'm going to go out on a limb and guess that the programmer came from a C background (where brevity tends to be valued and abstractions tend not to be) and used Java because it's cross-platform.

Re: Anyone who looks at this code instantly becomes insane

#17
Setting up a game world is notoriously imperative and makes every OOP-minded dev rip out their hair trying to do it how they think it should be done before realizing the truth that, for this kind of problem, ugly and imperative is good.

In my estimation, the sin is the cyclomatic complexity.

Re: Anyone who looks at this code instantly becomes insane

#18
I wouldn’t ever want to work with this code, but there’s a level of persistence here that I kind of respect. Sure, the code sucks, but I can’t help but feel like I couldn’t have written this even if I wanted to. There’s usually a point when I’m too deep in a nested conditional to remember all the variables, and that’s usually before 23 tabs in.

Re: Anyone who looks at this code instantly becomes insane

#19
It appears the author is well aware of this issue! From the readme:

"Back when I was first learning to program in Java, I decided to try to make a clone of the excellent PC game Terraria. Of course, I was convinced that my version would have many more features than the official one.

But before I realized how silly that idea was, I produced 11,000 lines of, to date, the most atrocious code I have ever seen in my life. I make it available here mostly as a cautionary tale of what can happen if you don't pay attention to the quality of your code. (Lesson learned, in my case!) Here are some of the highlights..."

Re: Anyone who looks at this code instantly becomes insane

#20

I wouldn’t ever want to work with this code, but there’s a level of persistence here that I kind of respect. Sure, the code sucks, but I can’t help but feel like I couldn’t have written this even if I wanted to. There’s usually a point when I’m too deep in a nested conditional to remember all the variables, and that’s usually before 23 tabs in.

It seems like you could use all the extra whitespace to embed another program within the program.
Post reply on HN