In today’s post: how to write better git commit messages; a cool debugger trick for Visual Studio; a new approach for producer/consumer programming in .NET Core 3.0; how to focus in on a part of a data structure; an alternative to a regular to-do list; how to apologize; protecting users against poor password choices; the NSA does the right thing; the day when someone discovered they had too many interfaces; a Java programmer discovers GoLang; and a Ted Talk on why privacy matters.
Sharpen the Saw used to be an email newsletter of information I published for the professional development of software developers. Now it’s a series of blog posts. While targeted primarily at developers working with the Microsoft technology stack, content covers a wider range of topics.
Always a way to improve the code you write every day.
A note about git commit messages
Writing a good git commit message can be a challenge. I’ve sure we’ve all seen codebases littered with commit messages like “Addressing PR feedback”, “Fixing off-by-one bug”, “Second attempt at fixing off-by-one-bug” and “It should work this time”. Here’s some valuable guidance on writing commit messages that are actually useful to any future developers looking back.
Debugger Trick when Working with UTC DateTimes
That moment when you learn you can use the
[DebuggerDisplay] attribute in more places than you thought.
Chris Missal blogs about using it to clarify date display when debugging - but it has much wider applicability.
Software & Updates
A new or upgraded tool can be a beautiful thing.
An introduction to System.Threading.Channels
For the cases when you need a producer/consumer model in your application, the new
System.Threading.Channels library might be just what you need. I know that I’ve encountered many situations where this library would have been extremely useful - and as soon as some of those projects are converted to .NET Core 3.0, I suspect I’ll be ripping out my bespoke solutions in favour of this library.
In functional programming, a Lens is something you can pass around that allows other code to focus tightly in on a specific part of a larger object, allowing the value to be easily read or modified, even if the larger object is immutable. This sample code From GitHub shows one way they can be implemented in C#. I haven’t quite got my head around how they work just yet, but it’s an interesting idea to play around with.
A great developer does more than just write great code.
The to-do list method for people with crazy lives and short attention spans
I’ve become one of those insufferable people who live and die by their to-do list; most everything I need to do goes into the list(*). I, therefore, found this short blog post from Lila MacLellan to be somewhat challenging, as they make the assertion that standard to-do lists incentivize the wrong behaviour. My takeaway is that the purpose of the list is to ensure I don’t forget things - but it’s a poor tool for selecting what I work on next.
(*) In my defence, I do try to avoid evangelising it with other people - the key is to find an approach that works for you. My brain leaks like a rusty colander, so I find some form of external backup is necessary.
How to apologize so people forgive you
It can be difficult to admit when you’ve made a mistake. In fact, some people find it so hard that they never admit their mistakes, not even to themselves. In this LifeHacker post, Aimée Lutkin suggests a useful technique for apologizing in a way that allows everyone to move on.
Staying safe online and writing secure systems are both harder than we think.
Pwned passwords in practice: Real-world examples of blocking the worst passwords
One of the services that Troy Hunt makes available as a part of Have I Been Pwned is an API giving a safe way to check whether a given password has been included in any of the breaches listed on the side. In this post, Troy highlights several ways that his service has been integrated by other providers, protecting their users.
NSA found a dangerous Microsoft software flaw and alerted the firm — rather than weaponizing it
The American NSA has a history of researching and discovering software flaws, hoarding them for later use. In a possibly surprising move (depending on who you talk to), they didn’t choose to keep this one secret, but instead formally notified Microsoft, enabling the flaw to be patched.
PSA: Make sure you have the latest Windows patches installed; if you don’t have the ones from January 2020, you’re vulnerable.
Sometimes the answer is random.
65535 interfaces ought to be enough for anybody
An interesting story digging into the implementation details of various .NET runtimes and how a limitation in one of them gave someone quite a headache. It all started when Audrey Akinshin came into work to find that her unit tests were failing even though none of that code had been recently modified.
Comparing Golang with Java
As some of my colleagues have adopted the Go language, I’ve been picking up details by a kind of osmosis as they comment on what they are doing. This probably means that I have a somewhat distorted view of things since they tend to comment on the extremes - the awesome features, and the quirks that they consider completely insane. This article by Peter Verhas gives some of his first impressions, based on his background with Java.
Take some time to feed your mind.
Glenn Greenwald: Why privacy matters
In this thought-provoking talk, Glenn Grenwald talks about the importance of privacy, how people dramatically change their behaviour when they think they’re being observed, and why people who assert that “only bad people have something to hide” are invariably unwilling to give up their own privacy.