Live data from Hacker News

Please do not attempt to simplify this code

github.com

61–70 of 327 posts

Re: Please do not attempt to simplify this code

#61
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?

Since they used aluminium in the Space Shuttle would that also reflect poor safety record on using aluminium in mission critical situations?

Re: Please do not attempt to simplify this code

#62

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…

5000 / 17 ≈ 295. Is it a fair assumption to make that a commercial program of equivalent complexity would take 295x fewer man-hours?

No, I don't think so, 295x is a crazy high factor. The article says 260 people are involved, and let's generously say it took 20 years to write the software (the first mission was 10 years after the program started and it was around for a total of 40 years).

Dividing by 295 means a commercial team of the same size could have done it in less than a month. Or with a 10x smaller team, about 8 months. I don't think either of those are plausible.

Re: Please do not attempt to simplify this code

#63
post #16

> // 1. Every 'if' statement has a matching 'else' (exception: simple error > // checks for a client API call) > // 2. Things that may seem obvious are commented explicitly Honest question: Why invent "safety" practices and ignore every documented software engineering best practice? 2,000 line long modules and 200-line methods with 3-4 if-levels are considered harmful. Comments that say what the code does instead of…

If you think these things are considered harmful, I'd encourage you to read "John Carmack on Inlined Code" http://number-none.com/blow/john_carmack_on_inlined_code.htm...

"The flight control code for the Armadillo rockets is only a few thousand lines of code, so I took the main tic function and started inlining all the subroutines. While I can't say that I found a hidden bug that could have caused a crash (literally...), I did find several variables that were set multiple times, a couple control flow things that looked a bit dodgy, and the final code got smaller and cleaner."

If Carmack finds value in the approach, perhaps we shouldn't dismiss it out of hand.

Also worth noting his follow-up comment:

"In the years since I wrote this, I have gotten much more bullish about pure functional programming, even in C/C++ where reasonable... When it gets to be too much to take, figure out how to factor blocks out into pure functions"

Re: Please do not attempt to simplify this code

#64
post #34
post #22

Earlier quoted context omitted.

The space shuttle became obsolete technology after all those years. Would've needed a redesign.

> The space shuttle became obsolete technology after all those years. Would've needed a redesign. Are people aware of how old the technology is that's currently putting objects and people into space? No, the space shuttle was not obsolete. It was expensive... very expensive. To this day, we still don't have a replacement for it's capabilities though.

Dream Chaser wants to fill those shoes.

- https://www.sierraspace.com/dream-chaser-spaceplane/

- https://en.wikipedia.org/wiki/Dream_Chaser

- https://www.nbcmiami.com/news/local/a-new-space-plane-gets-r...

- https://www.youtube.com/watch?v=jVIXI09-AYw

- https://www.youtube.com/watch?v=4Q8tGVUnoZg

Re: Please do not attempt to simplify this code

#65
post #16

> // 1. Every 'if' statement has a matching 'else' (exception: simple error > // checks for a client API call) > // 2. Things that may seem obvious are commented explicitly Honest question: Why invent "safety" practices and ignore every documented software engineering best practice? 2,000 line long modules and 200-line methods with 3-4 if-levels are considered harmful. Comments that say what the code does instead of…

Because sometimes, there's "No Other Way(TM)". Arbitrary line limits tend to unnecessary fragmentation. Add includes, licenses, glue code and comment; and you have an unapproachable spaghetti. Try to keep methods to 200 lines in high performance code, and see your performance crash and burn like Icarus' flight. When you read the comments in the code, you can see that they simplified the code to a single module, and e…

> Try to keep methods to 200 lines in high performance code, and see your performance crash and burn like Icarus' flight.

Are these loops in Kubernetes so hot that extra microseconds for some program stack manipulation will affect performance? I never took Kubernetes as a hyper-real time application.

>Do not obey them blindly and create problematic code bases.

I don't know the code so won't question it specifically, but wouldn't this also apply to "space shuttle programming"? I feel Space shuttle programming's job in many ways is in fact to try and remove ambiguity from code. But not by explaining the language, but the variables and their units. I sure wouldn't mind spamming "units in cm" everywhere or explaining every branch logic if it's mission critical. Not so much this inconsistent doxygen/javadoc style documentation on every variable/class. If you're going to go full entrprise programming, commit to it.

Above everything else, the big thing going through my mind reading these are "a proper linter configuraion would have really helped enforce these rules".

Re: Please do not attempt to simplify this code

#66

Earlier quoted context omitted.

Wasn't a poor safety record whut killed the shuttle. It was the cost, and anticipation of degraded safety, in the future. Even though more astronauts died, because of the two shuttle accidents, than any other NASA disaster, the safety record was absolutely amazing, when we consider everything that was going on. The code seems damn good code.

2/100 catastrophic failures (deaths of entire crew) is not a good record even by the standards of spaceflight.

[deleted]

Re: Please do not attempt to simplify this code

#70
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?

Wasn't a poor safety record whut killed the shuttle. It was the cost, and anticipation of degraded safety, in the future. Even though more astronauts died, because of the two shuttle accidents, than any other NASA disaster, the safety record was absolutely amazing, when we consider everything that was going on. The code seems damn good code.

> Even though more astronauts died, because of the two shuttle accidents, than any other NASA disaster, the safety record was absolutely amazing, when we consider everything that was going on.

That's "the operation was successful but the patient died" logic. Killing over 1% of your riders is not a good safety record! No ifs, no buts.

Post reply on HN