r/badcode • evil • Jan 14 '21

js Dynamically created functions are the future!

Post image
795 Upvotes

102 comments sorted by

View all comments

7

u/Tomekske Jan 14 '21

Please, stay on full stack. It should be forbidden for you to program a microcontroller for humanity's sake

13

u/Niosus Jan 15 '21

Hahahhaahaha. I've seen and worked on code that ships in cars. Thousands upon thousands upon thousands of lines of C code. Not a unit test in sight. Functions being executed multiple times in a row as workarounds for race conditions. "Tactical" void pointers. And of course, it wouldn't be a proper C program without storing all the state in a global context.

Luckily that code was only used for the infotainment system. But honestly, I don't think the safety critical code is going to be that much better. The only reason we managed to ship relatively bug-free code is because the QA team was really good at their job and found most of the bad stuff before it reached the customers...

Humanity is screwed.

6

u/TigreDeLosLlanos Jan 15 '21

I think I now understand why QA is so well paid.

5

u/GuinnessDraught Jan 15 '21

Same, but airplanes.

2

u/pwnedgiraffe Jan 15 '21

Dude I am scared of flying as it is, I don’t want to know.

2

u/GuinnessDraught Jan 15 '21 edited Jan 15 '21

The saving grace is that aerospace still invests in massive QA operations and exhaustive testing. You can thank the FAA for that, though they have some serious egg on their face with the 737-MAX debacle. But it's a constant battle.

Unlike most other software shops that have just rolled QA into developer responsibilities and decimated QA departments.

Granted, they could probably save a boatload on QA if the developer quality was better instead of contracting and outsourcing so much of it. The result of massive QA of bad code is even worse code, but at least for known cases it is reliable to an outside observer.

4

u/b1ackcat Jan 15 '21

But honestly, I don't think the safety critical code is going to be that much better.

Also worked on code that shipped in cars. The safety critical stuff is definitely better than what you described. Mainly because every single bit and execution flow is accounted for. The systems are designed to work with a very specific set of constraints and they are absolutely purpose built for a given set of features and never anything more. And yes, QA qa's the everloving shit out of it too.

I know what you mean about infotainment systems, though. I worked with those. non software development engineers should not be writing that kind of code lol