logoalt Hacker News

bijowo1676today at 7:49 PM1 replyview on HN

switch is example of explicit control flow, which Clean Code argues strictly against.

the better approach would be to use implicit control flow using class hierarchies, interfaces, and such and rely on class behavior, polymorphism and runtime dispatch, instead of explicit switch() which tends to multiply itself across the codebase


Replies

fodkodrasztoday at 8:16 PM

You accidentally used the phrase better approach, instead of Clean Code.