Software

Applications

Microsoft rang in the new year with a cutesy tweet in C#. Just one problem: The code sucked

When marketing meets coding


Microsoft has ushered in 2022 with an amusing (and now deleted) tweet from its Windows Developer account that answers oh so many questions about the quality of code emitted from Redmond nowadays.

As is so often the case, the code (which looked like it aimed to greet 2022 with a perky "Happy New Year") doesn't appear to have troubled a reviewer before going live. Taking aside the fact that it's going to whinge about it still being 2021 when it isn't, there's also the use of the ToString() method when other properties might well have done the job better. And why the "=="?

Click to enlarge

Still, it's the thought that counts. One should consider oneself fortunate that one's own well-intentioned coding cockups have never plopped out of the social media orifice of a company with a market cap in the trillions.

Memories of having to deal with the frankly barking mad US date format still haunt your correspondent to this very day. And then there were the time zones to worry about...

The tweet attracted the usual barrage of supportive and helpful comments typical of Twitter, including a meme from one of Microsoft's own coding boffins, Scott Hanselman, who later followed up with a useful video he described as "an overly detailed analysis of a bad DateTime comparison in C#."

The video is well worth a watch, not least because it delves into not just the obvious flaws in the code but also other considerations that need to be taken into account when handling dates.

As for the original code... well, at best it'll probably keep insisting it is 2021 aside for one brief second. And let's face it, even that isn't right. As another commenter observed: "Yeah 2021 is wrong. We're still stuck in 2020." ®

Send us news
86 Comments

Microsoft gets new Windows boss as Start Menu man Parakhin 'to explore new roles'

More MS moves just a week after new AI unit and other changes announced

Windows Format dialog waited decades for UI revamp that never came

'Temporary' isn't always

Microsoft confirms memory leak in March Windows Server security update

ALSO: Viasat hack wiper malware is back, users are the number one cause of data loss, and critical vulns

EU antitrust cops probe Microsoft ties between Entra ID and 365 services

Google claims rival has made an 'art and science' out of licensing

Microsoft drags Windows Subsystem for Android into the trash

Amazon Appstore tieup fizzles out, too

Meta, Microsoft, X, Match pledge selves to Epic battle against Apple App Store

You have my sword ... and my bow ... and my axe!

Microsoft defends barging in on Chrome with pop-up ads pushing Bing, GPT-4

We thought you people wanted choice, IT colossus sniffs

Developers beware, Microsoft's domain shakeup is coming soon

If you don't pay attention, your lovely little Teams app will stop working

The end of classic Outlook for Windows is coming. Are you ready?

Microsoft prepares to replace an old faithful with something shiny, new, and lacking key features. Sound familiar?

Microsoft hits Inflection point, peels off top personnel to form AI division

FYI, FTC: Karén Simonyan, DeepMind co-founder Mustafa Suleyman absorbed rather than acquired

Licensing labyrinth for Power Apps and Dynamics 365 must be clarified, warns expert

Rules still unclear for Microsoft users making potentially costly decisions on enterprise applications

Microsoft says AI alliances are needed to compete with Google

Only the Chocolate Factory is 'vertically integrated' to win at 'every AI layer from chips to a thriving mobile app store'