I guess one should drees appropriately for what one is doing, and especially take care to avoid giving offense. For example I will wear a kilt in most of England only when formal evening dress (so waistcoat and doublet, higland shoes) is required or at meetings of Highland or Gaelic associations/societies, otherwise I'll wear trousers or shorts, but different rules apply in Scotland. When meeting with venture capitalists it make be appropriate to look as unconventional as possible or it may be appropriate to look very conventional, depending on who the vcs are and sometimes also on what they are expecting. I've been known to wear grey suit, white formal shirt with double cuffs, IEE Fellow's tie (that tie earns lots of points with many technical managers), and mirror-polished Oxfords when meeting customers, and pressed light brown slacks, tan dress shoes, and slack short-sleeved shirt for other customers. What I wear in the office has varied enormously accoring to which firm I was working for. I dress completely differently when in Spain of Sothern France because the climate requires it, for example I normally wear sandals (as does pretty well everyone else, except tourists) - but definitely no shorts or short-sleeved shirt when looking around monuments or landmark (buildings or natural) with any sort of religious significance (no shorts for such in the UK either, but short sleeves are OK in most such places in the UK), no shorts on any sort of formal occassion and I often wear a straw hat, but in the other parts of europe I've worked in I have dressed much as in the UK. In the office I'm either bearded or clean-shaven, not in-between - switching from clean-shaven to bearded needs some time of absence from the office, but that's generally not been a problem. Different employers have had different dress codes - none of them unreasonable, I've never been expected to wear a tie anywhere near an old-fashioned printer or a multi-platter replaceable disc drive and hardly ever anywhere else, and none of them requiring a suit except when meeting customers, suppliers or backers - eg no suits for meetings with executive directors / senior vice-presidents of my employer. As a senior VP myself and for a while acting CEO I didn't see any reason to impose any stricter dress code than keep customers etccetera happy and maintain decent hygene and don't come to work looking as if you can't afford unpatched clothes or looking as if you've grown three sizes since the clothes you are wearing last fit you, and no footwear that renders you unable to walk properly or damages the flooring.
Now that I'm mostly retired, of course, I just make sure I'm warm (when in the UK) or cool (when in Lanzarote) and comfortable. No need to worry about any dress code other than one I impose on myself.
Having interviewed a lot of IT people and been very unimpressed by the general level of technical capabilities, I came to the conclusion that rejecting someone for a technical IT job on the basis of dress was not a sensible thing to do if they were technically competent and were willing when asked to adopt the company's dress code; of cause if they weren't willing, that was the end of it - given how mild the various dress codes were refusal to comply would be indicative of some sort of childish rebellion, and the risk of that carrying over into their work wouldn't have been acceptable any more that the idea of having to manage someone with that childish attitude, or inflict that sorry task on someone else, and to watch the attitude (not the dress, necessarily) disrupt his relations with his colleagues was.