In today’s post: An obsession with primitive types can be a problem; Ways to refactor to introduce semantic types; WSL now supports GUI apps and it’s wonderful; Lessons from Japanese martial arts; How to prepare to break a habit; Spam blogs; Why your sleep excuses are wrong; Morning habits and happiness; and Phil Haack’s most excellent CodeMania 2012 keynote.

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.

Design Smell: Primitive Obsession

Consider the fundamental data types built into your language. Typically they are int, double, string, char, and bool, though the exact set depends on your language. Go includes complex, C# includes DateTime, C++ doesn’t include string, and so on.

Of course, they are extremely useful, but sometimes they’re the wrong solution, often because they admit too wide a range of values.

Over reliance on primitive data types is known as Primitive Obsession and it’s a subtle source of bugs. In this blog post, Mark Seemann gives some good definitions, as well as some useful links for further reading.

Read more:

Code Smell – Primitive Obsession and Refactoring Recipes

Over on the NDepend blog, Patrick Smacchia makes the case that while primitive types are the real building blocks of your application, over reliance on them can lead to problems.

Within the .NET base class library, a file path is often represented as a string, with a large number of helper methods to work with the path. It turns out that a proper encapsulation (such as that made available via the NDepend.Path NuGet package) is surprisingly complex.

My experience shows the introduction of a simple semantic type to replace use of a primitive type will almost invariably flush out some bugs in the application.

Read more:

Software & Updates

A new or upgraded tool can be a beautiful thing.

The Initial Preview of GUI app support is now available for the Windows Subsystem for Linux

This is exciting - you can now run Linux that require a GUI within WSL2 without having to install a separate X-Server and fight with Windows firewall settings.

Aside: I’ve had an X-Server installed on my work machine for some months, but every time I want to use it, I have had to go back and fight with the Windows Firewall settings because the required exclusions keep getting reset. With this release of WSL2, I don’t have that problem any more, everything just works.

So far I’ve used both GoLand and GitKraken under WSLg and they’ve worked flawlessly.

The only difficulty is that it’s only currently available on the Windows Insider Dev ring, so you have to opt in to a certain amount of instability to get access.

Read more:

Being Professional

A great developer does more than just write great code.


From Japanese martial arts, Martin Fowler teaches us about the ideas of Shu-Ha-Ri - describing how a person passes through three stages of gaining knowledge. This is both a good way to assess your own progress towards mastery of a subject, but also a good way to think about how to pass on what you now to others.

Read more:

Four Questions to Ask Before You Try to Make or Break a Habit

Whether it’s New Year, your Birthday, Lent or some other date on the calendar that’s of significance to you, making resolutions as a way to improve your habits is common. Gretchen Rubin thinks the key to making resolutions that work is to understand what kind of person you are before you begin.

Read more:


Staying safe online and writing secure systems are both harder than we think.

The Abercrombie and Fitch Brown Pants Fiasco, “Splogs,” and you

There are tools out there for creating spam blogs - or splogs. In this article from 2012, Scott Hanselman diggs into one such fake site and finds literally hundreds of clones, all leeching off the Abercrombie and Fitch branding.

Scott summarizes it well: “The internet is way, way, more screwed up than you ever thought.

The goal of the scammers is simple: to get your credit card details and steal from you (or, some variation of the above).

Staying safe on the web is even more of a challenge today than it was back in 2012.

Read more:


Sometimes the answer is random.

3 Excuses You Make for Not Getting Enough Sleep (and Why They’re All Wrong)

It’s difficult to over estimate the value of a good nights sleep. If you’re like most people, you don’t get enough sleep - and you can point to a dozen reasons why that happens. In this article, the author argues that they’re actually in control of their three most common reasons.

Read more:

5 Things You Should Do First Thing In The Morning To Be Happier All Day

How good is your mental health first thing in the morning? If you, like many people, would like a better start to your day, here are five suggestions:

  • Pick a wellness habit, then link it to an a.m. ritual you already have.
  • Get your phone out of your room.
  • Talk to yourself…
  • … and somebody else.
  • Incorporate gratitude.

Read more:


Take some time to feed your mind.

CodeMania Love To Code Keynote

Back in 2012 the keynote for the very first CodeMania conference was delivered by Phil Haack - and it’s purely wonderful.

Audience: Everyone Duration: 27m

Read more:

Watch now:


blog comments powered by Disqus
Next Post
Fixing GitHub Authentication  28 Nov 2021
Prior Post
Gesticulation Driven Development (GDD)  24 Jul 2021
Related Posts
Using Constructors  27 Feb 2023
An Inconvenient API  18 Feb 2023
Method Archetypes  11 Sep 2022
A bash puzzle, solved  02 Jul 2022
A bash puzzle  25 Jun 2022
Improve your troubleshooting by aggregating errors  11 Jun 2022
Improve your troubleshooting by wrapping errors  28 May 2022
Keep your promises  14 May 2022
When are you done?  18 Apr 2022
Fixing GitHub Authentication  28 Nov 2021
July 2021