One thing that has to be spoken about although there are some very poorly written programs out there, often (especially in the past without simulation programs we have now), is that you have to think about being on-site, production manager looking over your shoulder asking when it will be in production, the fact you are tired, in a noisy environment & struggling a bit on some problem operation that may not have been seen in the original spec. so in some circumstances even the best programmers sometimes have to divert from their normal strict routine of problem sorting & making the code right, work & look good. Then the brain saying can't wait to get back to the hotel for that juicy steak & pint.
I certainly remember one occassion where under pressure to get the plant running as they wanted it, I modified the code, worked well, on my way home the brain was still working overtime, suddenly a simple solution came into my head I realised the modifications were a bit on the fly & this new solution would have been easy to implement & keep my code in some sort of order, when sometime later I was asked to add some extra features I thought I would modify the scrappy code I put in previously as well as put in the new routines, however, when I got to site I thought to myself, NAH... If things go wrong on that original code I'm in for trouble so left it even though I was not happy.