News for hackers. Stuff that matters.
Re:TerrariaClone – An incomprehensible hellscape of spaghett... by tgb on Thursday October 12, 2017 @06:45PM (#15461926)
When I first started programming (this was in C++), I decided that the obvious optimisation was to declare all these redundant local indices i,j,k as globals. Then the program won't need to make all this redundant crap! Of course that led to absurdly subtle bugs that only occasionally showed up since whenever I called a function which had a loop in it from inside of another loop, I would use i as the index for both loops. Error! I learned several important lessons when I figured that one out.

But now the author here says they're doing that same thing! How has this not inevitably led to problems? Or am I misunderstanding the scoping in Java?

Re:TerrariaClone – An incomprehensible hellscape of spaghett... by raxod502 on Thursday October 12, 2017 @10:28PM (#15462885)
Original author here.

The fact that all the methods were so ridiculously large made declaring loop indices globally less of a problem. But trust me, it caused plenty of bugs... :P

Re:TerrariaClone – An incomprehensible hellscape of spaghett... by MetallicCloud on Thursday October 12, 2017 @09:25PM (#15462686)
I'm sure it would have lead to problems, that's just one of the examples of beginner mistakes with the code. That's kind of the point of this post, for the author to poke fun at themselves for the number of newbie mistakes they made.