DEV Community

Discussion on: Eliminating Nulls in C# with Functional Programming

Collapse
 
seangwright profile image
Sean G. Wright

I'm a big fan of this pattern for removing incorrect nulls from an app.

I was first introduced to it in this blog enterprisecraftsmanship.com/posts/... and my explorations into F#.

I did look at the Ext library awhile ago for ideas but didn't want all my code to start taking dependencies on such foundational pieces from a 3rd party package.

I always find it tricky to know when my C# is getting too functional for it's own good... 😁

Collapse
 
integerman profile image
Matt Eland

I view .NET as basically a plundering band of nomads at the moment - taking the best concepts and even syntax from other languages. It's what keeps the platform relevant, but it also makes .NET a very broad subject to learn.

The Option pattern isn't too hard to code on your own if you don't want external dependencies, though some of the syntactic sugar from automatic conversions of Some values might not be as polished.

Honestly, a lot of the value in things like this is just the concept and the level of polish and documentation on something. I'm a huge fan of the Scientist library, for example, and that library is actually really simple under the covers, but represents a novel approach.