Software reliability guru C. K. Cho admonished the industrialist not to think of software as a product but as a portable factory. Your problem is to make a factory that will generate zero-defect answers. The methods of making a factory that produces perfectly reliable widgets can be easily applied to creating a factory that makes perfectly reliable answers. Ordinarily, software is constructed according to three centralized milestones. It is first designed as one big picture, then coded in detail, then finally, near the end of the project, it is tested as an interacting whole.
Software is designed, coded, and tested daily, in a hundred cubicles, as each person works on it.
Usually that customer is the coworker you hand your work off to. And you don't hand off your work until you've done the milestone cycle in miniature-specifying, coding, and testing what you made as if you were shipping it. In essence, software is grown from the bottom up in a manner not unlike Rodney Brooks's subsumption architecture. Each inchstone is a small module of code that works for sure, and from which more complex layers are added and tested. Inchstones alone won't get you zero-defect software.