4 ms·
> There are perfectly valid situations where your friend could be right. I didn't say he thinks banning goto is dogmatic (and I never heard him say that his te
by fizixer 9y ago
> There are perfectly valid situations where your friend could be right.
I didn't say he thinks banning goto is dogmatic (and I never heard him say that his team completely disallows any use of it). You could be against goto and still be okay with its occasional use.
He seemed to be of the opinion that there is no reason to be against goto in the first place, because he never felt goto's use hurting his productivity. (and his use of goto, the way he explained it, definitely was more complicated than the rare cases where I think you could let it slide, e.g., the way it's used in the linux kernel code to get to the bottom of a function in case of failure, etc).
And why should we be against goto in the first place? Unfortunately, you cannot answer this question in one sentence, or a paragraph. "Go To Statement Considered Harmful" is not a theorem that has a proof. You have to read about it, and ideally, you have to experience what spaghetti code feels like, and what a goto-free codebase feels like. If you're not willing to take such a dive, you would never find out the answer. And if you have opinions in favor of goto without taking such a dive, don't be surprised if I lower my opinion about you as a scientist/engineer.
> Maybe he wants to become a manager with good developped principles?
And call me a negative nancy but your chances of developing good practices have diminished if your bad coding practices are reinforced through internal awards and the like. And I have no doubt his contributions may have felt significant to the higher ups enough to decide this deserves an award. But only in the short term. If this code gives problems in the next quarter or something, do they go back and review if the hasty implementation in the last quarter and liberal use of goto had anything to do with it? Likely not if your company doesn't even have a coding-conventions document.
- sbov 9y agoI think it's pretty simple to make the case for goto, or any construct, being harmful in a work environment. Code is ultimately social, and if your colleagues find it difficult to read or use, then by definition it is harmful. For another example, I love functional programming, but my colleagues hate it. It is, by definition, harmful for me to use at work.