Pattern Matching vs. Polymorphism

Building an extensible architecture

Fabian Böller
Better Programming
Published in
5 min readAug 11, 2019

--

Photo by 贝莉儿 NG on Unsplash

TL;DR

Subtype polymorphism is great for adding more entity types. Pattern matching is a better choice for adding more functionality. In many use cases, it’s likelier that more functionality is requested than that more entity types are requested.

--

--

I’m a senior software engineer working in Bonn at LeanIX. I write about software development best practices across multiple programming languages.