4 ms·
I don’t necessarily disagree with the author that the “prefer composition over inheritance” advice is taken too far, but I don’t find this example to be too per
by actuallyalys 3y ago
I don’t necessarily disagree with the author that the “prefer composition over inheritance” advice is taken too far, but I don’t find this example to be too persuasive. Most of the simplification comes from using a list and named triple instead of new classes. Those are good techniques, but they aren’t inheritance. (Well, data classes tend to be better, but named tuples are perfectly fine here.)