IMHO the only decent solution to poor programs is to build better programmers who are not ignorant and don't take shortcuts. But of course good programmers and good code cost more time (and money) which is why the market does not select for those traits.