News for hackers. Stuff that matters.
Re:The faster you unlearn OOP, the better for you and your s... by dragonwriter on Sunday November 25, 2018 @01:17PM (#18527988)
> It strikes me as bad design if something as simple as an action (hit) now needs to become it's own class

Why, it's a noun in the problem domain. Why shouldn't it be a class?

> that is instantiated merely to execute a single function and then have to delete itself.

This may be inefficient in some language implementations because of limits of optimization, but there is no fundamental reason that, if that's all you do with it, the compiled code or runtime behavior needs to be much different than if it were just a procedure call.

On the other hand, lots of times you will want to do more than that with actions occurring in the domain then executing them (queueing, logging/serializing, etc.) and having a datatype for the event (a class in class-oriented OOP) supports that.

There are no comments on this comment yet.