読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

97 Things Every Programmer Should Know 59 Missing Opportunities for Polymorphism

読書ノート

polymorphism isn't simply about alternate implementations. Used carefully, polymorphism creates tiny localized execution contexts that let us work without the need for verbose if-then-else blocks.

While there are cases where it's much more practical to use if-then-else instead of polymorphism, it is more often the case that a more polymorphic coding style will yield a smaller, more readable and less fragile codebase. The number of missed opportunities is a simple count of the if-then-else statements in our code.