2 ms·
It was a mix of short and long and there wasn't really much "style". The company had taken over the maintainership from someone else at some point (before I joi
by arp242 3y ago
It was a mix of short and long and there wasn't really much "style". The company had taken over the maintainership from someone else at some point (before I joined) and it was all fairly inconsistent. I don't really mind the inconsistencies as such, it's just the argueing over nothing that I mind.
This kind of stuff was typical. At some point there was a lengthy discussion which prevented rolling out a rather important hotfix over:
while (true) {
if (someCond()) break;
if (otherCond()) break;
[..]
}
It wasn't even about whether someCond() and otherCond() should be in that while(..) condition, it was allegedly "dangerous" because it "could loop infinitely". Well, ehh, that's the case with any lop innit? That's kind of how they work? There was a bunch of instances of code like this, "but it's still dangerous". Hmkay...
Oh, and then there was the great "evil incident". I had rewritten much of the frontend to this newfangled thing called "jQuery" that was all the rage. That was all fine and worked pretty well, but suddenly there was a bug hubhub about the jslint comment; the keyword to allow eval() was "evil" (one of those not-too-funny Crockford jokes), so at the top of /static/js/app.minified.js?v=12311 in prodiction there was something like:
/*! jslint: keyword1 evil keyword2 */
/*! MIT license blah blah */
minified_js()...
And people were up in arms and there was a big panic deploy during lunchtime for this "because customers might see this, and it's highly unprofessional, and it's a big problem we need to fix ASAP" etc. etc. etc. This was in the Netherlands with regular people, not some highly conservative part of the world. It was downright surreal and bizarre.
What I'm trying to say is that these people were rather obsessed with minor details to a point I've never seen before or since. Hell, there was a Company Blessed IDE™ that you had to use. Nothing else allowed. It was a complete piece of shit (IMHO) and after a few weeks I just used Vim. It worked. I got stuff done. No one was bothered by it. Still got comments I shouldn't be doing that...
While I didn't formulate "is this really objectively better yes/no?" clearly at that time, I'm sure it's been a pretty big influence.
- IanCal 3y ago> it was allegedly "dangerous" because it "could loop infinitely". Well, ehh, that's the case with any lop innit? That's kind of how they work? No? You can clearly have loops that exit. Loops that can be infinite should only be so where you really want that to happen in those cases / are fine with it. "Infinitely until the user does X with no timeout" is a fair one.
- arp242 3y agoEvery while/for loop is essentially "keep doing this until I tell you to stop". You can argue what the best way to "tell to stop" is, but that doesn't really change the concept. No one could even articulate under which conditions this could happen. Cosmic rays altering memory? That's the kind of stuff we're talking about here. For a PHP webapp. I don't recall the exact specifics but we spent a long time on that stupid loop and no one even had any alternative. Eventually the loop committed. The thing is, if I had written the conditions in the loop body it would have been fine with no comments. People were tripped over the "while (true)" and commented on that. That's okay, I can just change that, no problem. But the kept analysing and thinking about it to the subatomic detail. That as really the problem: small things tended to escalate to "a big thing" even when it was just a small thing. I don't know what it was – a kind tunnel vision? I don't know. I once carefully suggested to paint a wall in a brighter colour during a HOA meeting. People objected. Fine, not a big deal and just a suggestion, I'm okay with the grey it was. They kept discussing it. I back-pedalled harder. People started to suggest we need to form a committee. I started to run. They asked if I wanted to join the committee "as I had brought up the issue". I overtook Usain Bolt. I heard they had several meetings. They choose the same grey it was before (or something so similar I couldn't spot the difference). Not my favourite colour or what I would have chosen, but it's fine.
- joshuamorton 3y agoI can prove, pretty trivially that for i in range(10): Will halt. Slightly less trivially, you can prove that while true: if x: break else: break Will halt. But once the if conditions aren't exhaustive, it becomes difficult, perhaps impossible, to know that you won't end up in a weird unhandled state. Preferring and even insisting upon code that is not only possible, but easy, to reason about is good. Or iow it should be incumbent on you to prove the loop halts, not on the reviewers to prove it doesn't.
- arp242 3y agoYou can prove that a different construct from a different language can do a different thing because it's a different construct from a different language. > it should be incumbent on you to prove the loop halts This is a nice one-liner platitude, but also completely unworkable.