News for hackers. Stuff that matters.
Re:“Clean” Code, Horrible Performance by int_19h on Tuesday February 28, 2023 @08:35PM (#34977618)
For the same reason why you need a virtual drawLine etc. Because some code wants to render something, and doesn't want to care if it's rendering onto an on-screen surface, into a file etc.

Your entire system will not be burdened with virtual calls in places where you use concrete implementations (so long as they're final/sealed, anyway). The overhead is only there if you try to use the abstraction generically, but why would you do that in the case where the virtual call "will always be static in practice"?

There are no comments on this comment yet.