I know a lot of people associate dress codes and rules with boring offices and asshole bosses, and there are certainly a lot of companies that have both. But I think that if proper management is assumed, formality shows a respect for your work, your coworkers, your customers, and yourself. That sounds like a headline from a company memo, but think about it for a second.
If I run a company and I expect my employees to come to work and take what they are doing seriously, would I encourage them to drift in and out of the office as they please, take naps if they don't feel up to the task at hand, and wear tshirts and cargo shorts into the office? It is true that if I enact strict policies, people will flee the culture shock to the comfort zones of startups with laid back young employees where they can have nerf gun fights and drink beer on the job. But the fact is that those people are like a disease that spreads and I don't want them in my company anyway. I want the people who are coming in to kick ass and make us successful. There is a symbiotic relationship involved here- people who embrace that culture are going to come and be immensely successful and contribute. People who do not would not have done a good job because they would always be half-assing their work because they don't take it seriously. I'm not sure if the reverse is true for the laid-back work environments, however.