One of the key factors for success as a software developer is to work smarter, not harder. These posts contain tips on how you can do just that.

Error Methods

Saturday, November 25 2017 smart-code

Make the exceptions thrown by your methods more informative and useful by including more information with each exception. Do this by delegating the creation of exceptions instances to helper methods that focus on one task.

Read more »

Pass implementations, not representations

Saturday, October 14 2017 smart-code

A friend/colleague of mine, George, made an interesting assertion - that he prefers passing implementations, not representations. As we talked and unpacked what he meant by this, I discovered a deceptively simple idea that can make our code significantly more flexible and adaptable.

Read more »

Avoiding the Singleton Pattern

Saturday, July 22 2017 smart-code

Last time, we discussed the singleton pattern and looked how it can be easily implemented in a correct way by leveraging the Lazy<T> class. Now let’s look at why you almost certainly don’t want to do this.

Read more »

Implementing the Singleton Pattern

Saturday, July 15 2017 smart-code

The Singleton design pattern is one of the most well known from the famous book by the Gang of Four, but it’s well overused and often poorly implemented. Let’s discuss why that is and how the singleton pattern can be properly implemented (hint: it’s easier than you think). In a follow-up post, we’ll discuss why you almost never want to do this.

Read more »

Static Analysis tools for the Win

Saturday, April 15 2017 smart-code

It’s no secret that I’m a big fan of static analysis tools, believing that they can provide a very useful second opinion on my code, helping me to deliver high-quality code that does what it is needed.

Read more »

Exception Logging

Tuesday, January 19 2016 smart-code

When something goes wrong in a .NET application, it’s important to log sufficient information from the exception for diagnostic purposes. Here are some ideas on how to do this well.

Read more »

On the Merits of Simple Code

Saturday, November 28 2015 smart-code

As developers, we seem to love building complex things. This might be because being good at complexity is a prerequisite to becoming a developer in the first place. But this doesn’t mean that complexity is always necessary.

Read more »

Semantic Types

Sunday, September 27 2015 smart-code

As anyone who has seen my presentation Becoming a Better Developer will know, the anti-pattern primitive-obsession describes a practice that encourages the proliferation of bugs. The best way to counter this problem is to introduce semantic types.

Read more »

Command Line Processing

Sunday, September 21 2014 smart-code

Despite the popularity of application servers and single page web apps, there are still times when a simple console application is the easiest - and best - way to solve some kinds of problems.

Read more »