With complex software, it's pretty dang hard to layout an entire program in specifications without going down the provably correct approach, which likely will run into limitations when the real world is involved. Waterfall dev for operating systems of the past come to mind.... Probably the best you can do is be very stringent with your coding standards, something space agencies are the masters of.