2 ms·
I also think that every tool has its purpose. Just because it can be misused isn't reason to banish it altogether. In the end, readability and maintainability
by lmilcin 6y ago
I also think that every tool has its purpose. Just because it can be misused isn't reason to banish it altogether.
In the end, readability and maintainability of the code is primary concern. I don't really care for those fads that say "you should absolutely ban switch statements". I look at these as a collection of tools that help me make the code more readable.
Usually radical statements like this come from people that will take the simple naive code and make it completely incomprehensible for exactly opposite effect that the "best practice" was supposed to achieve.
Heck, there are even good uses for goto that make the code more readable as long as you follow accepted convention and don't try to be fancy with it. When I spent couple of years working on embedded ANSI C applications I often used it to make complicated inner loops (like reading and parsing input from device) more readable.