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.

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