Using C# 7 and Succinc<T> to give F# a run for its money

Yesterday, I saw on twitter a link to a blog post entitled “An F# rewrite of a fully refactored C# Clean Code example”, by Roman Bossart. The F# code is compact and easily understood. So I was curious as to what the “fully refactored C# Clean Code” looked like and followed the links therein to have a look.

Continue reading “Using C# 7 and Succinc<T> to give F# a run for its money”

Using Succinc<T> to overcome IEnumerable code smells

SuccincT
The IEnumerable<T> interface has numerous extension methods associated with it, including a number that return a single element if a match occurs, or return the default value for the type if that fails: FirstOrDefault, LastOrDefault, SingleOrDefault and ElementAtOrDefault. These methods create two code smells due to the nature of .NET’s type system. As of version 1.5.0, Succinc<T> offers alternatives to these methods that overcome those smells.
Continue reading “Using Succinc<T> to overcome IEnumerable code smells”

Do you SHOF? Higher order functions in OO languages

If you live in the world of OO languages, you likely fall into one of two categories:

  1. You are still happily using inheritance, switch statements, nested if/else collections, have methods that are hundreds of lines long etc. You possibly haven’t heard of TDD or DI. There’s a very good chance that, if this is the case, you’ll likely never see this post as you likely do not read blogs by other developers.
  2. You do read around, you are aware of why inheritance, switch, deeply nested and long code blocks are frowned upon by the well-informed. You are at least aware of TDD, even if you haven’t quite started using it yet. Also, you are likely aware of the growing excitement around functional languages and perhaps look on with envy at some of their features. If this is you, you possibly already use SHOF’s without knowing it.

Continue reading “Do you SHOF? Higher order functions in OO languages”

Introducing Succinc<T> – functional additions to C#

SuccincT logoTo certain extent, the title of this post is a little dishonest: it’s not really the first time I’ve introduced Succinc<T> on this blog. I first mentioned it over two years ago. To explain the title therefore, some history is required.

During early 2013, I was indulging myself in a “thought experiment” language: Lapsang. One such thought experiment was around the idea of whether a language could sensibly support the concept of not throwing exceptions for petty, unexceptional, reasons. Continue reading “Introducing Succinc<T> — functional additions to C#”