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.

Avoid hardcoded wait times

Saturday, May 26 2018 smart-code

When developing systems that must wait for key things to happen (often, things that are outside their direct control), we need to consider how long we’re willing to wait for an answer.

Read more »

Guaranteed Progression

Saturday, May 19 2018 smart-code

Long ago, before storing things in the cloud was commonplace or economic, I used an online mirroring tool to replicate all our family photos between my desktop PC and my wife’s netbook. This was both effective and painful - here’s why.

Read more »

Prefer declarative method names

Saturday, February 03 2018 smart-code

Coming up with the right name for a method can be a challenge even if you’re sure you know exactly what it should do. All too often, I find that part of the reason why I’m having trouble choosing a name is that I haven’t really decided the purpose of the method.

Read more »

Using Premeditation

Saturday, January 27 2018 utility-class smart-code

If you have a utility class in your current code base, there’s something very important you should do - even before you apply any of the techniques we’ve discussed previously.

Read more »

With Relocation

Saturday, January 20 2018 utility-class smart-code

Sometimes you’ll find a method on your utility class that’s only used once - or only from a single consuming class. This frequently happens when a developer genuinely believes the method will be generally useful and should be available for reuse, but is wrong.

Read more »

Using Consolidation

Saturday, January 13 2018 utility-class smart-code

Sometimes your utility class will contain methods that smell strongly of feature envy, prompting you to relocate them onto an existing class. This is a much simpler cleanup than introducing a semantic type.

Read more »

Using Semantic Types

Saturday, January 06 2018 utility-class smart-code

Following on from our discussion on extension methods, another technique you can use when eliminating the dumping ground of your utility class is the extraction of buried semantic types. This is possible when you find a set of closely related methods with linked semantics.

Read more »

Using Extension Methods

Saturday, December 30 2017 utility-class smart-code

Think about the larger projects you’ve worked on during your career. Did you have a dumping ground for odd pieces of functionality? Perhaps a utility class or even multiple multiple utility classes? It’s a very common thing to see a utility class in any codebase of reasonable size, especially one that has been around for a while.

Read more »

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 »