logoalt Hacker News

leecommamichaeltoday at 7:17 PM1 replyview on HN

> you'll wish you had a conceptual entity that encapsulated the operations on the type of workflows so you just had to implement them in one place.

Why have you drawn the conclusion that the author is against this? A function with a switch-statement can do this.


Replies

bijowo1676today at 7:49 PM

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

show 1 reply