Couldn't agree more. This transformation is easy to do when you have a single member function, not when you have dozens of them, and more class trees for other parts of your system. Not to mention that they picked up only the simple shapes, where it's possible to multiply width by height and then by some factor :)

BTW, for the "corner count" example, I think common guidelines would suggest making it a data member that is saved in the base class and initialized by the c-tor, not a virtual function (but some maybe wouldn't, as it increases the size of each object).

On Wed, Mar 1, 2023 at 10:39 AM JC van Winkel via SG20 <sg20@lists.isocpp.org> wrote:
Hi,

I came across this article (summary of a video) that says that we are teaching people the wrong things.

My feeling is that the presenter is cherry picking the worst possible examples and values micro-optimizations over maintainability and I wonder how often the presenter has worked on really large code bases...

JC
--
SG20 mailing list
SG20@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/sg20