visitor-heterogeneous-advantage-encapsulation-contingent

Status: OUT

Visitor's structural generalization over Iterator (operating on heterogeneous type collections without requiring a common parent) provides genuinely broader extensibility only while Visitor does not break encapsulation — requiring element classes to expose internal state through their Visit interface may negate the flexibility gained by removing the common-parent constraint, trading type-hierarchy coupling for implementation coupling.

Justifications

Visitor's type-heterogeneity advantage requires encapsulation preservation

Depends on (SL): gof-visitor-no-common-parent-required, iterator-separates-traversal-from-aggregate

Unless: gof-visitor-breaks-encapsulation

JSON