Bad design and bad project management vs the accountants....
Many years ago I worked on some civil aircraft software. It's purpose was simple: take a number of inputs from "real world" sensors and a single "command" from the pilot/auto pilot and produce just one output which was to control the engine thrust. There were three processors and a voting system. In addition to doing this job there was some logging (to magnetic memory!) for specifics like maximum thrust called for, temperature extremes, vibration alerts etc.
The control software was derived from Pascal but was designed in such a way that infinite loops (aka lockups) were not possible. It was really a specialised state machine. The point is this software was only accepted for use if it ran perfectly on all three different hardware platforms. Also, the code and test harnesses for each hardware target were written by different teams behind Chinese walls.
Assuming the overall software design was good - and this was not a trivial process to get through and signed off - the final product was eventually signed off after all tests were passed by at least two test teams. And, of course, the documentation was humongous.
In the context of the current Boeing crisis I cannot help but think that there must be some serious compromises going on for their systems to fail as they clearly are.