Hacker News new | past | comments | ask | show | jobs | submit login

Hit is an event that occurs, so not sure why it should escape OO even though in this example even though it's only decreasing ints. I routinely code event objects rather than modifying another class directly by the delta that should occur. OO isn't good for continuous time and events but it does add ergonomic convenience for the developer in this case (there could be other information on the hit, a historical list of Hits looks better as List<Hit> rather than List<int>, it's easier to inspect a hit object during debugging rather than setting watches on player/monster/weapon values).



You could even serialize the Hit classes and throw them on a message bus, and have them automatically applied across the network or something.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: