The end of the using 'block' in C# 8?

Intro

C# 8 unfortunately seems to be branching away from the standard .Net Framework and its not (fully?) compatible with the full .Net Framework, instead you have to use DotNetCore to get the benefits of it.

Read More

F# handling the option type

Intro

The steady march towards learning F# continues. This time lets look at the option type, what it is, how it compares to nullables in C# and the basics of how you are supposed to deal with it. I originally started this post because I was dealing with option in a lot of my exploratory code, and the things I’ve read online about options implied they were special in some ways, but the further through I got the more I realise they are really just the F# version of the Nullable type in C#, its how they are handled functionally thats special.

Read More

The solution to FSharp missing .Net Framework Projects in Visual Studio

I went to create a .Net framework F# console app as part of a larger existing .Net Framework solution, and found that the project dialog didn’t give me that option for a full .Net Framework project. I thought this was a bit weird, so did some googling and found that you have to install the F# Desktop Language Support pack.

Read More

Async tests with NSubstitute and XUnit in C#

Intro

This is just a really quick post on how to write async test methods in C# with XUnit and NSubstitute. Thankfully its quite simple these days, and is very useful to know as async calls become more and more commonplace.

Read More

FSharp - Category Theory - Monoid

Introduction

This is the first post on category theory terms, which is sort of like a mathematical version of design patterns in the functional world, but as you might expect they are at a much lower level than the OO design patterns.

Read More

TypeScript common linq command equivalents / CheatSheet

Intro

Linq in c# is a great abstraction, it massively reduces the amount of code to do fairly basic operations, using TypeScript doesn’t mean you lose this functionality, its just a little different to achieve many of the operations. In this article I’ll run through the basic Linq-To-Object operations, and how you can achieve similar results in TypeScript.

Read More

Reduce unit test friction patterns - 3 - Never create time dependent tests

The Problem

There are loads of cases where this applies, but a simple one is: You have a target class that spawns a thread which updates a field with its result and you want to test that the result is set correctly. The really naive solution is to simply start the thread in your tests, do a Thread.Sleep() in there for the amount of time it takes for the result to be updated and check the result is there. This is bad in a couple of ways.

Read More

Patterns to reduce unit test friction series

I’ve decided to write a bunch of patterns and practices up in a concise way that help to make unit testing in .Net a better, lower friction experience. Getting started unit testing can be quite painful, and its not usually until after you have written large numbers of tests that many issues come to light.

Read More

Just Write Something - The Antidote to Analysis Paralysis

This is going to be an opinionated view as to the most efficient way I’ve personally found create a software design, heavily based on core OO & XP principles, allowing software to grow naturally, TDD and refactoring. It may not suit everyone, and I’m sure some people will disagree with it, but I’ve found these things to really help reduce unnecessary friction.

Read More

The TDD toolkit

I’m going to try to do a few posts on test driven development in the .Net world. Yeah its been covered quite heavily already, but I think more information out there can only be a good thing, can’t it?

Read More

Unit Test More

Unit testing is hard, you aren’t going to learn it overnight, you may not reap the benefits of it immediately, you may not have a code base that supports them, but persist and long term, the benefits will start to appear. This is especially true with code that is harder to test with more traditional methods. TDD is the next level of this, and tends to be even harder to apply at first, but can be a great benefit once you get the hang of it.

Read More

The Argument Against Comments

Comments imply the code does not speak for itself. Code with a lot of comments, usually has them because the code itself doesn’t adequately represent what its doing, and in most cases it could be changed so that it does describe itself correctly without a huge amount of upfront effort (apart from a few oddities to do with technological limitations, or odd requirements imposed on the code base).

Read More

hello world

So this is it.. blog post number 0. Not really sure how or what to write, but I’ve got a shiny new github pages repository… so lets have a go.

Read More