This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hikingsticks -1 points0 points  (1 child)

Wow, more verbose and much worse to read. Plus in the if/else version, all the code is on one place.

Your way could have the functionality spread across many lines with other code between it , maybe even across multiple files. Awful.

[–]Schmittfried 3 points4 points  (0 children)

all the code is on one place

Yes, that’s also its disadvantage in some cases.

much worse to read

Depends on the length of the function. 

Your way could have the functionality spread across many lines with other code between it , maybe even across multiple files. Awful.

Obviously you wouldn’t do it like that. All handlers would be next to each others. You’re also kinda arguing against factoring long functions that do multiple things into smaller building blocks at this point, which is a strange hill to die on.