I'll be blunt. This is the wrong lesson.
The correct lesson is:
Assume the software will do the worst thing possible. How will you prevent that from causing a catastrophe? I.e. make the Therac-25 physically incapable of generating an excessive dose.
This is how airplanes are made safe. Not by imagining you can create perfect hardware or software, but by assuming any part can fail, and how does the airplane continue to fly safely?