It seems to me that code gets ugly because the incentive structure rewards coders with a large feature velocity. If they write garbage that mostly works but will be very hard to maintain or expand, they can write on their resumes that they delivered the features and use that as a basis for a new, higher paying job.