Deadlines
The root cause of this dissatisfaction is often unrealistic deadlines. If The Boss is not particularly aware of the nuances of analysis and coding there may be undue pressure to produce results. What a lot of bosses are unaware of is that it might take x days to meet a deadline, but this might be taking major liberties with design, so that when a further deadline is set which, to The Boss, is simply an incremental step, might involve a major back-track. In database work, for example, it may be even confirmed in an email from on-high that "you can leave postal addresses as one field, we'll never need anything more detailed." Then... later... "this report you've done is all very good, but I'd like to see it in zipcode/postcode order" which involves a complete rehash of the address fields.
Having an "interface" between management and those doing the design and coding that understands both budgetary concerns and the technical aspects of coding is essential. Someone who is prepared to dig their heels in when good design and good coding principles are at stake. Get that in place and I suspect motivation and morale will soar.