Live data from Hacker News

Anyone who looks at this code instantly becomes insane

github.com

21–30 of 81 posts

Re: Anyone who looks at this code instantly becomes insane

#22
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.

Even OP is telling them to pump their brakes. Anyone who doesn't have a sense of humor about their younger self's code probably still writes the same quality spaghetti.

Re: Anyone who looks at this code instantly becomes insane

#24

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.

Yeah. This is the code of a very smart person who didn't take the time to make abstractions, either through laziness or naivete. I've seen much more deeply-wrong code that would be much harder to refactor into something maintainable than this would be.

Re: Anyone who looks at this code instantly becomes insane

#26
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.

I love that the function is called "resolvePowerMatrix."

What does this function do? Oh the power matrix? Oh it resolves that? Cool.

Re: Anyone who looks at this code instantly becomes insane

#27
post #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 gu…

That's not bad, actually. It's one reason why I hated leaving Perl for Python. Python is a little too orthodox sometimes.

What I'm seeing is where frameworks are becoming the new "programming languages". People now bicker over what framework to use rather than first master the language they are using for a task. I tend to favor the method of "do the simplest thing that works".

Re: Anyone who looks at this code instantly becomes insane

#28

It compares favorably to the official Terraria code (decompiled version here): https://github.com/TheVamp/Terraria-Source-Code/blob/master/... Terraria extensively used God objects with hundreds or thousands of properties, and used naive C# serialization for its netcode. This meant that sending the state of a single object would take over 1KB, leading to truly outrageous network requirements for a 2D platformer game,…

That's decompiled or automatically generated code, right?

I have to believe there is a 0 percent chance a human wrote all of that. It's the only thing that will keep me sane 8)

Re: Anyone who looks at this code instantly becomes insane

#29
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.

"treating it like a friend, like a spider u know? not gonna kill it but also gonna make sure the webs arent in ur personal space" lol
Post reply on HN