DEV Community

Discussion on: 3 tips for clean & efficient code

Collapse
 
pinotattari profile image
Riccardo Bernardini

If the language allows you, declare pre- and post-condition for your function and type invariants for your types. They are powerful bug traps. If a post-condition gets triggered when a function return, you have quite a strong hint about where the bug lies.

Collapse
 
deepu105 profile image
Deepu K Sasidharan

could you provide a sample? and wouldn't those be considered side effects?