Live data from Hacker News

TerrariaClone – An incomprehensible hellscape of spaghetti code

github.com

111–120 of 289 posts

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#111
post #43

Earlier quoted context omitted.

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…

Comments like this kill me a little on the inside, I can't stand having real work devalued for the sake of contrived assessment criteria.

well the AP comp sci test stuff is not all contrived. it is also useful to know (mostly)

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#113

I did a 3 month contract working on porting Terraria (the actual game) from XNA to Unity and updating things like UI from sprite batching etc. Coincidentally and fwiw, the actual source code to Terraria was also a hellscape of spaghetti code.

> porting Terraria (the actual game) from XNA to Unity

Can you talk about this? What was involved? Why do it? Major roadblocks? Do you feel it was it worth it?

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#114

I did a 3 month contract working on porting Terraria (the actual game) from XNA to Unity and updating things like UI from sprite batching etc. Coincidentally and fwiw, the actual source code to Terraria was also a hellscape of spaghetti code.

Ah, so you're the one to blame for the "loss" of hour upon hour of my kids' lives. It's pretty nice to see them sitting side by side on the couch, each with an iPad, muttering gibberish at each other. Warms this nerdy father's heart. :)

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#115
post #25

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

Nah, just the one incomplete and incorrect mental model will do just fine.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#116
post #44

Earlier quoted context omitted.

I really like this method: https://github.com/raxod502/TerrariaClone/blob/fd1ff8b8b0e78...

Well, it's faster than %, but I bet it's premature.

Why do you say it's faster? It's guaranteed to fail branch prediction one out of ten times. My guess is that'd be a lot slower than using the integer modulo operator, which is not an expensive operation.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#117

This 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…

I miss the rush

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#118

Earlier quoted context omitted.

It is often impossible to write code the first time anyways, just do it, realize your technical debt, and come back and refactor it when the better abstraction is more obvious (if any).

Ah, but try that in an interview and see what happens.

Interview coding skills are different from real world coding skills.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#119
post #66
post #44

Earlier quoted context omitted.

I really like this method: https://github.com/raxod502/TerrariaClone/blob/fd1ff8b8b0e78...

That is probably (x + 1) % 10 assuming x is non-negative. That kind of code is responsible for quite a bit of the verbosity, the author was obviously not aware of many of the little tricks usually used in this kind of code.

Also assuming that x <= 9.

Re: TerrariaClone – An incomprehensible hellscape of spaghetti code

#120

This 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…

"first you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer"

https://mobile.twitter.com/KentBeck/status/25831623306839654...

Post reply on HN