An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
June 29, 2019 10:39 pm GMT
Original Link: https://dev.to/mazentouati/how-do-you-handle-the-disposable-if-statements-hi6
How do you handle the disposable IF statements ?
Hi there,
Sometimes you need to write a conditional block that will only be executed once or for a brief period of time then the condition won't be satisfied again, like for ever.
An example for these IFs is
// User activationif (!user.activated) { alert('please activate your account'); return false;}
The idea of that residing code that won't be executed again has been bothering me for years. I'm kind of picky and sometimes go crazy about micro-optimization, but sometimes I just ignore it. However, I feel that there's a great design pattern that I'm not aware of that may make me feel better about it.
What do you think ? Do you share the same feeling ? and how are you dealing with it ?
Photo by Carolina Pimenta, Unsplash
Original Link: https://dev.to/mazentouati/how-do-you-handle-the-disposable-if-statements-hi6
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To