Mechanism Easy Difficult
Classes adding types adding functions
Data Structures adding functions adding types

Right. So when you add a new type, very little changes. Now suppose you want to add a new function - say the center function.

Well then you’d have to add that to all three types, Circle, Square ,and Triangle.

Good. So adding new functions is hard, you have to change each class.

But with data structures it’s different. In order to add Triangle you have to change each function to add the Triangle case to the switch statements.

Right. Adding new types is hard, you have to change each function.

But when you add the new center function, nothing has to change.

Yup. Adding new functions is easy.

-- https://blog.cleancoder.com/uncle-bob/2019/06/16/ObjectsAndDataStructures.html