3 ms·
> Of course, this trick violates every coding standard in the book. […] I would claim that the coding standards are at fault here. Thoroughly disagree here. Th
by kccqzy 3y ago
> Of course, this trick violates every coding standard in the book. […] I would claim that the coding standards are at fault here.
Thoroughly disagree here. The coding standards for not at fault for rejecting this code, but rather the code is merely a cute trick. Software engineering in the large is all about removing surprises and making code readable even to the sleep-deprived on caller waking up at 3am to debug this. You can't rely on programmers remembering the ground rules all the time (and there are four of them!)
> Coding standards aim for clarity. By hiding vital things like switch, return and case statements inside "obfuscating" macros, the coding standards would claim you have obscured the syntactic structure of the program, and violated the requirement for clarity. But you have done so in the cause of revealing the algorithmic structure of the program, which is far more likely to be what the reader wants to know!
It takes skill to write programs that see clear in both their syntactic structure and their algorithmic structure. This isn't it. (I am a fan of Rust creating implicit state machines from async functions and I think that should be the model here.)
- userbinator 3y agoEndlessly "dumbing down" lowest-common-denominator crap is what's responsible for the quality, or lack thereof, of most software today. Shunning knowledge and education will come back to bite you.
- bdjsiqoocwk 3y agoSeconded. Not everything is about the sleep deprived on call guy, not everything is about reducing surprises, not everything is about operations. I had thought before that this "what about the guy at 3am arguments" push in the direction of mediocrity - happy to see I'm not the only one have these thoughts.
- furyofantares 3y ago> quality, or lack thereof, of most software today. Also the incredible quantity software today, and how dang cheap it is.
- kccqzy 3y agoFeel free to write your artisanal code in your personal projects. But they don't belong in most companies' code base. You are a cog in the machine at these companies. Your role is to produce code that's easily understood by the next programmer. That's why coding guidelines exist.
- kragen 3y agothat's why all those companies are using putty instead of their own ssh client; they're organizationally incapable of writing software of putty's quality
- chongli 3y agoA lot of these companies don’t ship software at all, they write it only for internal use. It needs to be easily fixable by junior interns, not dependent on Bob the 100X programmer who decided to retire last week.
- kragen 3y agoyeah, and of course you normally want as much as possible of your software to be easily fixable by junior interns in any case; that's always better when there's no compensating drawback the implicit premise of your comment, however, seems to be that no such compensating drawback is possible, presumably because internal-use-only software isn't a competitive advantage. there are a lot of companies that think that way, but i think it's shortsighted; see https://news.ycombinator.com/item?id=39402299 https://news.ycombinator.com/item?id=39402299 for some examples of companies that discovered that it mattered a lot how good their internal-use-only software was
- offices 3y agoHaving gone from C to C++, there's a stark difference between the communities in what is considered 'readable' i.e. what the future reader is expected to grok. In C-world, ternary-ifs are too spicy and C99 is newfangled. In C++ world, the only reason you'd be pushed away from template metaprogramming is because the standard you're using lets you do it with constexpr.