cover-img

Code Smell 42 - Warnings/Strict Mode Off

Compilers and warnings lights are there for help. Don't ignore them.

9 January, 2023

10

10

0

Problems

Missed Errors

Ripple Effect

Fail Fast

Solutions

1.

Enable all warnings

2.

Enable preconditions and assertions in production.

Sample Code

Wrong

Right

Detection

Most languages have warning levels. We should turn most of them ON.
We should run linters to statically analyze our code for potential problems.
# Tags

Fail Fast

Conclusion

If we ignore warnings and code moves on sooner or later it will fail.
If the software fails later it will be very difficult for us to find root cause.
Defect will likely be near first warning and far away from the crash.
If we follow the Broken Windows Theory, we should not tolerate any warnings, so a new issue will not pass unnoticed on a sea of tolerated warnings.

Relations

More Info

Credits

One man's crappy software is another man's full time job.

Jessica Gaston
This article is part of the CodeSmell Series.

10

10

0

Maxi Contieri

Buenos Aires, Argentina

🎓Learn something new every day.📆 💻CS software engineer 👷coding👨🏽‍🏫teaching ✍🏾writing 🎨Software Design 🏢SOLID 🌉TDD 👴Legacy 💩Code Smells

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.