你的评论
Thank you, Daniel! I'm glad that you enjoyed my work!
Hi!
I think the closest thing to what you wanted is the https://gameprogrammingpatterns.com/
I'm not aware of a more game-dev-focused book/resource on patterns.
Hi!
Yes, it's already in my plans (I can't have any time estimates, though).
The code has become more compact, but I don't think there was any improvement in readability. In fact, it becomes harder to grasp what this method is doing because:
1. You now have a break in mental context - you have to travel mentally to methods calcOcKeyNum and addToObject to check what they do (it's still not obvious.)
2. The addToObject method is not self-contained, which makes it even harder to grasp its logic.
Hi!
I would prefer #1.
Yeah, I think a lot about it as well. All the refactoring is only needed for us, humans. If AI will ever learn to code, I doubt it ever needs to refactor anything at all, it will comprehend the ugly code just fine: "it's good as long as it works".
Hi!
To be honest with you, I don't see a reason to change something in it. Yes, it may look a little messy, but so does the format of the input. Without changing the input and possibly, the output as well, this method wouldn't become much better. If there are others similar to this one, then maybe it's worth making some sort of data mapping. Otherwise, you would see similar lines in my own code.
In my experience, the "modern OOP" is all about pushing the ugly stuff under the rug (to the client code). For example, a framework or a library that you're using might be a pinnacle of design, but it requires you to write a ton of ugly configurations to start the thing. It's generally unavoidable to have this sort of code somewhere, and the most that you can do is to move it to a single place and make it as small as possible.
UserEcho 的客户支持
Hi!
You might be right about that! Moreover, I think most patterns violate some of his principles, for example:
Still, for better or worse, the patterns are used universally and not just in the Python world.