3 ms·
That's why we usually group all of these handlers into a single Visitor interface. Then you only add one class and one extra method to the Visitor, and all the
by Twisol 6y ago
That's why we usually group all of these handlers into a single Visitor interface. Then you only add one class and one extra method to the Visitor, and all the other variants stay the same.
You're brushing up against the so-called "expression problem", though, where you can choose between adding types easily or adding algorithms easily, but not usually both.