When you can't find a clear answer... May be you asking the wrong question.
Create code is - in my opinion - a service, not a product...
If you keep paying a service like it is a product it will continue to be inefficient and open to opportunitistic behaviour.
What about changing the reward model then?
What you, programmer, get paid some fix price for expenses coverage and then a fee for each week (or month) you're software runs without a flaw? Or a fee that goes on as long as software keep working (with your eventual maintenance and fix help, of course).
This would make customer happy (he has a working programmer) and do reward more the best programmers.
The main issue of one-time assessment on programmer job is, in fact, that you not always discover software flaws immediately.. it takes time..