3 ms·
The article is pointing out (I think) that since C# and F# are such different paradigms, they have different best practices for handling invalid states. F# has
by pionar 11y ago
The article is pointing out (I think) that since C# and F# are such different paradigms, they have different best practices for handling invalid states.
F# has these best practices built in to its type system. The way the author is coding the domain models, there's no way for the model to be in an invalid state.
C#, on the other hand, does not give this safety in its type system (and doesn't make it easy to "abuse" the type system to provide it). One can use contracts[0] to do this, but it provides mainly runtime checking, not compile-time checking like F#.
[0]http://www.dotnetcurry.com/csharp/1172/code-contracts-csharp-static-runtime-checks http://www.dotnetcurry.com/csharp/1172/code-contracts-csharp...