I wonder how hard it would be to write a program to automatically refactor code like this into something reasonably clean. My intuition thinks it should be difficult but possible... and extremely useful.
TerrariaClone – An incomprehensible hellscape of spaghetti code
91–100 of 289 posts
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#92As a cooperative endeavor it should be doable, but a competition would be more fun, though I can't imagine how you'd judge such a thing.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#93I 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…
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#94Earlier quoted context omitted.
Writing code in spare time, not to mention 11,000 lines of it, already sets any high schooler (or any beginning programmer) apart from the majority of peers. It's shocking how little students in "AP" computer science courses actually end up doing, and how few do anything outside of class. Given the choice between interviewing a student who had produced nothing but verbiage and one who had produced TerrariaClone, I wo…
I had a rather unique AP Computer Science high school experience a number of years ago. The AP class was mainly a self or group study class inside of a lower level programming class. We didn't get as much directed study, but we basically were allowed to chose projects that interested us and spent a lot of time developing them and getting help, iterating, figuring it out. We ended up doing only OK on the AP exam, but…
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#956560 loc in TerrariaClone.java. Closed tab, will never look again.
Some of it is just plain data (arrays), a lot of the rest is a bunch of setters one after another.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#96http://sohcahtoa.org.uk/kepler/tmoon.c Grunge C and huge comment block at start, compiles and works though. One day, I'll revisit this and have a think about data structures.
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#97I'd actually try to recruit raxod502 at the high-school senior level. It certainly shows passion and commitment. You just need to grok the higher level abstractions. And may in the end even find your "spaghetti" version is actually more performant at run time ;) The thing is you sort of need to write like this for the first draft of your first game. And Terraria is pretty ambitious. Considering most people struggle w…
Writing code in spare time, not to mention 11,000 lines of it, already sets any high schooler (or any beginning programmer) apart from the majority of peers. It's shocking how little students in "AP" computer science courses actually end up doing, and how few do anything outside of class. Given the choice between interviewing a student who had produced nothing but verbiage and one who had produced TerrariaClone, I wo…
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#98Earlier quoted context omitted.
One of the things it took me a while to intellectualize is that 'you' a year ago is a very different person from 'you' today. Given enough time, maintaining a much larger body of code than a single person can reasonably handle, you're going to have disagreements with yourself without even realizing it.
Absolutely. When I stumble upon some code in my full time codebase that I find distasteful, my first thought is "what idiot did this". git blame and sure enough, it's me. Past me has been and always will be an idiot as far as present me is concerned (with some infrequent exceptions).
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#99I 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...
Re: TerrariaClone – An incomprehensible hellscape of spaghetti code
#100Earlier quoted context omitted.
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…
I swear I know a guy who would have done this. I have worked with him. I have cleaned up his code. I have asked him to clean up his code and been yelled at in response.
He is a manager now, though, not a day-to-day programmer ;)