In this issue from September 2017: The throw-if method pattern; live unit testing in Visual Studio 2017; diagnosing a slow test in NodaTime; improving password security; the largest git repo on the planet; and a preview of C# 8 with Mads Torgersen.
Sharpen the Saw is a somewhat delayed repost of a semi-regular newsletter of information I publish for the professional development of software developers. While targeted primarily at developers working with the Microsoft technology stack, content will cover a wider range of topics.
To subscribe, send me an email and I’ll put you on the list. Membership is moderated.
Always a way to improve the code you write every day.
The ThrowIf Method Pattern
This is an interesting way to factor out validation and enforcement tests, by creating dedicated methods that do the check and throw the exception in one hit.
Software and Updates
A new or upgraded tool can be a beautiful thing.
Live unit testing in Visual Studio 2017
One of the new features available in the Enterprise edition of Visual Studio 2017 is Live Unit testing. When you turn it on, the unit tests in your project will be run automatically, in the background, while you are typing. Symbols in the margin of your code give near instant feedback on the testing status of your code: Green ticks mark code that is successfully tested, red crosses mark code covered by at least one failing test, and blue dashes mark code that’s never tested at all. I’m hoping this feature matures and makes it into the other editions of later versions of Visual Studio.
A great developer does more than just write great code.
Diagnosing a single slow test
As a part of his crusade to educate developers on the need for good diagnostic skills, Jon Skeet has a great blog post talking about the steps he went through to diagnose a slow test in his NodaTime project.
It’s also worth keeping an eye on his ongoing series.
Staying safe online and writing secure systems are both harder than we think.
The Man Who Wrote Those Password Rules Has a New Tip: N3v$r M1^d!
Back in 2003, Bill Burr wrote a report for the US NIST that has become the standard reference for password security - use of obscure characters, a mixture of letter case and numbers, and so on.
He now says “Much of what I did I now regret”.
Fortunately, there are new guidelines - and they’re both easier to follow and more secure. The key advice: use a passphrase of four or more words. (Plus: Rotating passwords is now only advised if you suspect a breach! Hurray!)
Sometimes the answer is random.
The largest Git repo on the planet
When Microsoft adopted git as the source code repository of choice, they faced some unusual challenges. Have a read of some of the issues they’ve faced rolling out git to the Windows team - their repo is 300GB in size and contains around 3.5 million files.
Video of the Week
Take some time to feed your mind.
A Preview of C# 8 with Mads Torgersen
A quick look - on a whiteboard with lots of hand waving - at some of the features being considered for C# 8. The list includes nullable reference types, asynchronous stream support, default interface implementations and extensions for everything.