DEV Community

Discussion on: 1 small tip to improve your code readability

Collapse
 
winstonpuckett profile image
Winston Puckett

And... Follow. Fail fast is an amazing mindset. Thank you for using your voice to empower writing good code.

Collapse
 
robertotonino profile image
Roberto Tonino

Thank you man, being following Uncle Bob lessons lately and wow! Mind opened.

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

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.