Earlier quoted context omitted.
Decompiling .NET or Java binaries usually yields code very close if not identical to the original source code, at least unless an obfuscator was used but that seems not to be the case here. Chances are very good the original source code looks almost exactly like that code, maybe with some additional comments.
In this case, it's just that the decompiler didn't think of "else if" as a single control flow construct/keyword in the way that the original programmers did. What was no doubt written like this: if(a Decompiled into this: if(a
TerrariaClone – An incomprehensible hellscape of spaghetti code
61–70 of 289 posts
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#62This makes me miss my early days of programming, where no code was too verbose or horrible to stop me from progressing towards my goal, no matter how misguided I was. Nowadays I'm distracted by the first hint that there might be some better way, and all progress stops. I think I'm just beginning to recognize this, and maybe one of these years I'll learn to recognize when the right abstraction is really important and…
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#63I think true spaghetti code requires teamwork. I mean that seriously. You need at least 3 people all with different incomplete and incorrect mental models trying to modify the same codebase at the same time.
It's old school PHP, with sql queries mixed in with markup mixed in with php business logic - if that's not spaghetti code, I don't know what is.
(I'm replacing it, but it's a very slow process).
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#64This reminds me of the C# source code for DRAGON. Its code was actually much worse, because the creator wasn't aware of things like loops or method definitions (the main game loop and class appear to have been generated by a framework). The C# code is here, and it works well enough that you can buy it on Steam, apparently: https://gist.githubusercontent.com/alessonforposterity/832da...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#65This reminds me of the C# source code for DRAGON. Its code was actually much worse, because the creator wasn't aware of things like loops or method definitions (the main game loop and class appear to have been generated by a framework). The C# code is here, and it works well enough that you can buy it on Steam, apparently: https://gist.githubusercontent.com/alessonforposterity/832da...
It's almost 10k lines of nested if statements, lots of magic values and so on. Still one of the most enjoyable games of its time :-)
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#66I love DoubleContainer: https://github.com/raxod502/TerrariaClone/blob/master/src/Do... which is fortunately only used in a comment here: https://github.com/raxod502/TerrariaClone/blob/9ea04b15add48...
I really like this method: https://github.com/raxod502/TerrariaClone/blob/fd1ff8b8b0e78...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#67I love DoubleContainer: https://github.com/raxod502/TerrariaClone/blob/master/src/Do... which is fortunately only used in a comment here: https://github.com/raxod502/TerrariaClone/blob/9ea04b15add48...
I really like this method: https://github.com/raxod502/TerrariaClone/blob/fd1ff8b8b0e78...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#68Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#69I think true spaghetti code requires teamwork. I mean that seriously. You need at least 3 people all with different incomplete and incorrect mental models trying to modify the same codebase at the same time.
I disagree. I inherited an app that I'm maintaining that was written by one person over ~12 years. When requirements were added, he just cloned the app and started making the changes so the new app would meet the requirements. Repeat 2 more times, and you get to now, where there are 4 similar but not identical versions of the same code base, with inconsistently applied fixes to various bugs. All 4 still need to work…
Well, it was in an SVN repo... with a single commit.
It did have all the important switches at the top, none of them but the ones that were set actually worked.
Man, I "miss" that job.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#70This reminds me of the C# source code for DRAGON. Its code was actually much worse, because the creator wasn't aware of things like loops or method definitions (the main game loop and class appear to have been generated by a framework). The C# code is here, and it works well enough that you can buy it on Steam, apparently: https://gist.githubusercontent.com/alessonforposterity/832da...
The ability to buy something on Steam is sadly no longer a guarantee that it works.