Live data from Hacker News

Please do not attempt to simplify this code

github.com

321–327 of 327 posts

Re: Please do not attempt to simplify this code

#321

Related article on Space Shuttle Software Quality [0] Excerpt: "But how much work the software does is not what makes it remarkable. What makes it remarkable is how well the software works. This software never crashes. It never needs to be re-booted. This software is bug-free. It is perfect, as perfect as human beings have achieved. Consider these stats : the last three versions of the program — each 420,000 lines lo…

The problem with the Space Shuttle development methology is that it is insanely expensive and slow and still not 100% bug free.

It is so expensive and slow that it would be much cheaper, faster, and actually safer to prove the software correct using modern proof assistants.

Projects like seL4, CompCert etc. shows how it should be done.

Re: Please do not attempt to simplify this code

#322
post #4

// KEEP THE SPACE SHUTTLE FLYING. I understand the intent, but it is a bit funny that the comment references a system that is no longer operational due to its poor safety record. In ten years or so, will people even remember the Space Shuttle in a good light?

Well over 100 successful missions carrying a bunch of people and gear up into outer space and then bringing them back home. I hold it in a good light now, and will likely continue to feel that way. As far as human progress and net good, it was a success.

[deleted]

Re: Please do not attempt to simplify this code

#324

Am I weird in feeling like the code in this file is really really... normal? Like, it's verbose in certain ways due to being written in Go, as well as due to not relying on any deep abstractions (and I don't mind this - abstractions are a double-edged sword), but in general, as code, it seems typical - and if the header text didn't exist I wouldn't think twice about the style it's written in. Maybe the disconnect her…

I wish code like this still felt normal to me, but over the past ~10 years it seems that many people have come to value brevity over explicitness. I strongly prefer the explicitness, at least for important code like this. More than once in my career I've encountered situations where I couldn't figure out if the current behavior of a piece of code was intentional or accidental because it involved logic that did things…

I used to have opinions but I don't care anymore. After a spelunking into all manner of code bases I just match the style and move on. Verbose or terse, comments at the top or inline or nor none at all, 100 or 5 line functions, etc.

I treat it like a card game; follow what's led.

Re: Please do not attempt to simplify this code

#325
post #221

Earlier quoted context omitted.

Outdated comments are great, because it means you probably have a bug right there. If the comment didn't get updated, the code change probably didn't look at all the context and missed things. Pretty sure I'm guilty of that pretty often.

Looking at someone else's code, how would you know which was out of date, the code or the comment?

Looking at the commit history is a great start. Especially if your team actually empowers people to reject code reviews when the commit messages are unclear or insufficiently detailed.

Re: Please do not attempt to simplify this code

#326

Earlier quoted context omitted.

> I strongly prefer the explicitness I have a rule for my teams: "Don't write clever code". I try to constantly reinforce that we don't write code for ourselves, we write it for the next person. We should be doing everything in our power to decrease their cognitive load. I try to envision the person that comes after me (who may be me in months or years!) and imagine that they are having a Bad Day and they have to mak…

Can you give some examples of how elixir is too clever? It’s been a breath of explicit fresh air for me…

I know you can do these sorts of funky exercises [1] with pretty much any language, but elixir breaks my brain for some reason.

[1] https://evuez.net/posts/cursed-elixir.html

Re: Please do not attempt to simplify this code

#327
post #84

Earlier quoted context omitted.

The irony is this kind of describes k8s as well.

How so?

Hmm I guess my comment was kind of tongue in cheek. I think a lot of k8s was driven by political or pet-project reasons. E.g. using etcd.
Post reply on HN