Book Club 10/2023: Functional Patterns in C#

27 October 2023 2 Minutes History

This month I've focused on functional domain modeling and related patterns. We're just a few weeks away from the release of the next version of C#, and like each previous version it'll introduce even more functional features.

hero

This is a post in my Book Club Series.

My book club is a montly topical, curated list of things I've been reading, watching, or sometimes writing sent out via my email newsletter.

If you'd like to follow along with my book club, please subscribe; I won't email you more than once a month.

Happy spooky season!

This month I've focused on functional domain modeling and related patterns. We're just a few weeks away from the release of the next version of C#, and like each previous version it'll introduce even more functional features. We still aren't getting discriminated unions, but as C# becomes more functional, these patterns are becoming increasingly more attractive. Traditionally, C# is written in OO or procedural styles, and from my perspective there doesn't seem to be a great deal of discussion among C# engineers about incorporating functional patterns. Maybe you run in different circles, but I think there's room for improvement across the board here. Even the result monad, which can be used within an entirely OO context, is infrequently implemented.

I think it's important to be discussing functional patterns in C#, for a few practical reasons:

  • Eventually we're getting DU, and that's going to change a lot of things
  • Our F# colleagues are doing great work in this area, we should engage them more
  • Using functional patterns is cool

But above all, if C# supports these patterns and they can help us write better code, why would we neglect them? To explore this topic, I've curated a set of talks by Scott Wlaschin and Mark Seemann who both do a great job explaining functional programming from a conceptual perspective, demonstrating its power in F#, and ultimately demonstrating C# equivalents.

I hope these talks make you all as excited for discriminated unions in C# as I am!

Hi, I'm Ian

I'm a software engineer, architect, and team leader in Minneapolis. My career has largely focused on .NET and web technologies, spread across several industries. Currently I'm working for Crate & Barrel on their ecommerce solutions. You can find me on this blog, contributing to open source repositories, and at conferences around the Midwest.


If you'd like to keep up with me, please subscribe to my book club or RSS feed. If you'd like to help me out with server costs, I would be forever grateful if you bought me a coffee!


Some other posts you might be interested in: