3 ms·
What exactly is wrong about that? The nesting is too deep imho, but apart from that it looks ok. This looks more like a design problem, because there are lots
by qznc 14y ago
What exactly is wrong about that?
The nesting is too deep imho, but apart from that it looks ok. This looks more like a design problem, because there are lots of special cases, but the code style is ok.
- Jare 14y agoLook at the size of that thing That function is almost 1500 lines long, full of complex nested if conditions and commented out blocks. I understand how code (especially game character control code) grows to become like that, and I've probably been guilty of some similar horrors myself, but the most I can do with such code style is excuse it.
- qznc 14y agoSometimes the program logic consists of hundreds of cases and putting it all into one function is a good solution, since you see the complexity. I know that object-oriented best practice would suggest a lot of different classes and using dynamic dispatch for switching. That might even be faster. However, I dislike the fact that this scatters the logic across hundreds of files. The best solution would be to simplify the logic, but this is also the most costly/time consuming variant.
- JabavuAdams 14y agoI think you agree with the parent poster. By "code style" I assume they meant what you're calling "design problem".