3 ms·
> Bad code is the product of bad programmers This person is living in a pretend bubble that isn't grounded in the reality of large projects, multiple team memb
by echelon 4y ago
> Bad code is the product of bad programmers
This person is living in a pretend bubble that isn't grounded in the reality of large projects, multiple team members, deadlines, changing requirements, etc.
No programmer is perfect. And when your tool can cut your arm off, you should be careful or route around the dangerous bits when possible.
- cube00 4y agoIt's right up there with being told you shouldn't need any access to production if you programmed it correctly the first time.
- galangalalgol 4y agoYeah, I don't know how people say stuff like this without looking over their shoulder or knocking on wood.
- wruza 4y agoThis analogy implies that all other tools are 1000% safer, but they are not. In C it’s like pointing to a dusty corner behind a table in a room full of dirt. When was the last time you did “cut your arm” with goto specifically? What’s the count and time ratio to other issues? Were these also addressed as taboo or left as “experience earned”? Gotophobia in its largest part is just a stupid meme with no real world data.
- echelon 4y agoWhere do I imply other tools are 1000% safer? Even 30% safer is a win. 30% safer, 30% more readable, and 30% more productive would be even better. > When was the last time you did “cut your arm” with goto specifically? It's been a while since I've used C, and even longer since I've personally written goto statements. I do remember frequently getting tripped up on them right after undergrad. It's not friendly, and I don't ever wish to touch them again. I'm working in a C++ game engine project right now and it's constantly segfaulting. I can't imagine that setting register jumps manually in complex higher level code would improve my situation. When I get to choose the language, I use Rust. It fits the C use case and fixes many of the warts.
- wruza 4y agoI do remember frequently getting tripped up on them right after undergrad. It's not friendly, and I don't ever wish to touch them again. So it’s something bad from the undergrad past, no details. Must we take an advice based on that? I’m not sure I will. I'm working in a C++ game engine project right now and it's constantly segfaulting. I can't imagine that setting register jumps manually in complex higher level code would improve my situation. Neither would tabooing something based on weak or no evidence. “It doesn’t help here” and “we ban it and ostracize its use” are two different claims.
- echelon 4y ago> So it’s something bad from the undergrad past I was writing laser projector video games that played on the side of skyscrapers in undergrad. Speak for yourself.
- avgcorrection 4y ago> This analogy implies that all other tools are 1000% safer, but they are not. What an oddly specific presumption.
- jeroenhd 4y agoI see this "if you're good then you don't need safety" mentality in a lot of conversations with C programmers about programming languages. Maybe it's some kind of defencive response against newer programing languages slowly eating up spaces C used to be dominant in (like command line tools and system daemons), maybe it's just the programmer saying this thinking they're that special. Either way, most people saying this are setting themselves up for failure. I wouldn't start a new project in C unless I absolutely have to but if you disagree, you can at least admit that there are dangers in C that you need help with if you want to be sure you're doing everything right. With most warnings treated as errors, extended warnings enabled, linting to make things like missing brackets obvious, static analysis of all code to spot difficult bugs, automated dynamic analysis of test cases and a proper testing pipeline I believe you can write C code that's safe enough. In this case, I'm willing to give the authors the benefit of the doubt because goto hatred is worse than the risk posed by goto in most settings. Gotos used right are fancy if/switch statements and avoiding them in C can lead to a mess that doesn't add much safety. Most examples given are better in my opinion, because using goto can replicate the code flow modern languages provide with things like when/match/defer keywords.
- pjmlp 4y agoNah, it is like that since C exists, they used to call those of us that rather use languages from ALGOL systems programming linage as coding with straighjacket, or nany languages. I learned to appreciate C++ RAII already on Turbo C++ for MS-DOS around 1993, and using raw C has always been because I was required to deliver C code for some university projects or work.