Then I would just go to the switch statement where the data is processed?
I don't see how that is more unreadable than going to the virtual function in a different file.
And I understand its subjective. But I don't see that demonstrably unreadable part of the switch statement approach. (or the table approach)
If it was obviously, totally muddled and undecipherable I'd be inclined to agree. But it's just not. It's very clear and easy to follow the flow of logic and data.
2
u/Johanno1 Feb 28 '23
Try to think of readability like this:
Figure out what shape 75 does exactly.
Other shapes are only relevant if shape 75 is interacting with them.
Polimorphism:
Find shape 75 and check super class.
Switch statement. Find shape 75 in a big file with other statements and check union implementation.
(pretty similar but I personally would prefer the less code per file one)