DEV Community

loading...

Discussion on: 1 small tip to improve your code readability

Collapse
glsolaria profile image
G.L Solaria

Doesn't fail fast refer to asserting preconditions rather than silently doing nothing?

Collapse
robertotonino profile image
Roberto Tonino Author

You’re right, silence is always bad. Maybe I’m just too much used to it because of the codebase I work with. Gonna update the article with a throw. Thanks

Collapse
winstonpuckett profile image
Winston Puckett

What I gain from the post is that flipping your conditionals can lead to more readable code. There are lots of cases where this is very very true.

Silently doing nothing isn't good, but neither is dragging out your code by putting the "fast" case in the else statement.