Why Good Developers Write Bad Code: An Observational Case Study [pdf]
I had to write bad code because sales and management usually dictate the timeline of the project.As an example: sales promises new customer feature X in one month and we will lose money unless it's implemented.My choice is to either: 1) Complete it the right way in double the time or 2) use hacks and cut corners to get it done on time.  Since non-technical people just see the output and not what's going on underneath, they often times don't see the difference and when they explain to the boss that they might lose money, it's almost always option #2.I hated being forced to do this so many times in my career, I started my own company.