0

I have recently started working on a new DotNet Core project. I had noticed that someone (developer) used the Language-Ext library in this project. It was a new thing for me so I got to know that it is for Functional programming. It was quite confusing for me to understand it. I googled it and found benefits of it (Functional programming) :

  1. Less Code (main point)
  2. Easier Debugging
  3. Easier testing

For a OO programmer, functional programming is quite different. So, my question is do we really need to use Language-Ext (functional programming) in C#? Are there any other benefits which I am missing?

KiddoDeveloper
  • 568
  • 2
  • 11
  • 34
  • You could always create a project in your solution using F# if you really wanted to do functional programming and use it as a class library... – PmanAce May 21 '21 at 13:33

2 Answers2

4

So, my question is do we really need to use Language-Ext (functional programming) in C#?

If you want to do functional programming in C# you don't need LanguageExt, but IMO this is the best library for this use case.

Are there any other benefits which I am missing?

I'm biased because I use LanguageExt for some years now and it's my favourite library. If I create/edit C# projects without this library it feels a bit like working with an ancient C# version.

What more benefits are there?

  • Getting rid of (many1) bugs
  • Getting rid of much boiler plate code
  • Immutable data types
  • Avoiding side effects (easier parallel processing)
  • Easier refactoring
  • More type safety
  • Can be combined with non-FP C# code (use where useful)
  • Better refactoring skills (get another perspective)

LanguageExt creator Paul Louth created a great introduction showing some benefits: https://github.com/louthy/language-ext

The library now has a lot more features and if you get into this (and functional programming at all) you will find many gems.

(On the premise that you want to stay with C# -- and not use F# or Haskell or ...)

stb
  • 772
  • 5
  • 15
  • @std thanks for the answer. I recently started to learn about Language-Ext and love it. I wonder if there is a forum that I can ask questions. Do you have any advice? – DavidY Jan 24 '23 at 02:24
  • 1
    Valuable learning resources: discussions (forum), release notes, wiki, issues on the LanguageExt GitHub site. – stb Jan 24 '23 at 07:38
2

"do we really need to use Language-Ext (functional programming) in C#?"

of course not; it looks like some people choose to do that; this is IMO a tiny minority of C# users. If you wanted to embrace functional style, you'd probably look at F# (while C# does offer some minor nods to functional programming, it isn't the speciality of the language). If language-ext adds just that bit more that you want... great? But this is entirely subjective and contextual.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900