DEV Community


Discussion on: 1 small tip to improve your code readability

glsolaria profile image
G.L Solaria

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

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

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.