Live data from Hacker News

Anyone who looks at this code instantly becomes insane

github.com

1–10 of 81 posts

Re: Anyone who looks at this code instantly becomes insane

#6
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, on the order of >100KB/s/player.

Re: Anyone who looks at this code instantly becomes insane

#7

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?

Re: Anyone who looks at this code instantly becomes insane

#9
About 12 years ago I was working at a company in which a developer had recently left, and left behind some code that had a bug in it that needed fixing, the code was processing some XML and I knew a lot about XML so I was called over to look at this code.

The code was actually very simple, it consisted of for loops over a bunch of element nodes in which child nodes had to be compared with child nodes in other element nodes, or in which attribute nodes needed to be compared with other attribute nodes, whenever one of these nodes that needed to be compared with other nodes was found a new for loop would be started to loop over the whole set of nodes once again to find the attribute or element with children that needed to be compared with the currently selected attribute or element. I am describing this so succinctly and clearly for you so that you may experience a deeper understanding of just how succinct and clear the code itself was.

Whenever values where found that matched they were added to an array that was later looped over to get the values to actually doing something with them. They had printed out the oode, it was nearly 100 pages - I was pretty sure I could have done it in less than 2 pages (it was in C# and I sucked at C#), I mean the actual XML that was being analyzed would be less than 5 pages if printed.

After looking at it for a few minutes I announced that it should be rewritten. The other developers wanted to continue on with it to find the bug. I think they had been driven insane.

on edit: by less than 2 pages I mean that it might be more than 1 page but I suppose not 2 full pages.

Re: Anyone who looks at this code instantly becomes insane

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

Post reply on HN