DEV Community

Discussion on: Keeping your code clean by sweeping out "if" statements

Collapse
 
omicron666 profile image
Omicron

The usage of a map fits the mapping of handlers here.

But in general you don't want to over-engineer 15-line piece of code of if just for the beauty of it, especially if you have business logic in it.

Also, it is not canonical in debugging aspect : each time they need to cold read that code, people will feel the need to check Map.get(...) behavior in docs for non-existent cases, thus adding technical debt for no practical benefits.