Polymorphism과 sealed data switch는 서로 다른 변화 축을 최적화한다

둘을 취향으로 고르면 자주 추가되는 subtype이나 operation마다 수정 범위가 불필요하게 넓어집니다.

polymorphic method

새 subtype 쉬움 · 새 operation은 모든 subtype 수정

sealed data + switch

새 operation 쉬움 · 새 subtype은 모든 switch 수정·공개 API에서는 breaking change

핵심: 행동을 subtype이 소유하면 새 subtype에, 닫힌 data를 switch하면 새 operation에 유리합니다.