Yes, when, if ever? Most of us have to follow rules. It may be written or unwritten, however, they do exist. Special occasions require that we dress up. It's enjoyable, it shows the bride, the family, award winners, mourners, faith community, everyone and anyone that you feel this is an important occasion or ceremony.
JJ Lee @jj_lee interviewed Sonia Lawrence @, who seems to feel that a dress code is only aimed at girls, to protect them from leering male teachers. This is not the case. As a female teacher, I am uncomfortable looking at girls with nipples obvious, bra straps falling out of their shirts, bare bellies exposed, skirts too short to sit comfortably, no gym clothes on hand, and they'd refuse to participate in regular classes.
My grade 6 students were a perfect example. One young girl, mature beyond her male grade 6 classmates, loved to tease the boys. She thought it hilarious. Her yoga/dance pants would be rolled down low, hip bones exposed. She wouldn't have left the house that way, but her parents had already gone to work. While I was trying to teach a lesson, she would seductively raise her arms, stretch, and let everyone see her. They didn't know what to do, none of us knew where to look. Our purpose was to learn, not to flaunt our sexuality.
How can we do our science experiments, participate in gym, play outside at recess if they are under dressed?
There is nothing wrong with a dress code. We all have one in our workplace. I wouldn't got into my classroom wearing a skimpy outfit. It'd just gross everyone out. We dress for our purpose: to teach or learn. I don't like servers with nose rings and piercings, it really grosses me out. You wouldn't wear an evening gown to work in the ER!