Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I have recently stumbled across the Maybe (or Optional) modal usage in .NET Code: example code or this one example article Based on everything I read, there are multiple advantages on relyi...
#1: Initial revision
Are there any downsides related to using Maybe or Optional monads instead of nulls?
I have recently stumbled across the Maybe (or Optional) modal usage in .NET Code: - example [code](https://github.com/vkhorikov/CSharpFunctionalExtensions/tree/master/CSharpFunctionalExtensions/Maybe) or [this one](https://www.dotnetcurry.com/patterns-practices/1510/maybe-monad-csharp) - example [article ](https://blog.marcinchwedczuk.pl/random-thoughts-on-maybe) Based on everything I read, there are multiple advantages on relying Maybe instead of nulls: - no `NullReferenceException`s - leverage (some of) the functional [programming paradigm advantages ](https://www.unthinkable.co/blog-post/7-unbeatable-advantages-of-functional-programming/) I have also studied the implementation and usage of Maybe monad usage and all the code seems more "fluent" since there is no need for null checks (null propagation might help with this though). What makes me wonder is the fact that I have never seen this being used in enterprise projects I have worked on and not being mentioned by any of my colleagues. Are there any downsides in switching to using Maybe instead of the regular nulls? The only thing that comes into my mind is the need to ensure conversions at the service boundaries (e.g. the client might like `null`s instead of complex objects) and conversions when using ORMs (databases still work with NULLs or similar). However, these are part of the "infrastructure" code which you write only once per service.