Marcos Sandrini
Mar 11, 2021

--

*If* is a structure of pretty much all languages that is always there for a very good reason: it reads naturally, "like a prose", quoting Uncle Bob. Not only that but pretty much all compilers and interpreters today optimise around it so performance is not only a non factor, but I have actually seen code in which the "ifs" were taken off for "critical performance reasons" and, in the end, the performance decreased.

I see the point of the article and I agree with it that many *if* uses smell quite bad. However, I think that bad uses relate more to the organisation of the code (or lack thereof) than to the *if* itself. We should be very careful to emphasize that those structures are not inherently wrong or we may regret it in the future if fundamentalist "anti-if" devs becomes a trendy thing to be.

--

--

Marcos Sandrini
Marcos Sandrini

Written by Marcos Sandrini

Designer and front-end programmer with 20+ years of experience, also a keen observer of the world and its people

Responses (1)