After decades of relative obscurity, functional programming is finally coming into its own. With concise, easy-to-read code that supports asynchronous, concurrent processing, aspects of functional programming have begun to appear in several traditionally object-oriented languages such as C# and Java. This practical book shows C# programmers how to use functional programming features without having to navigate an entirely new language. Because of the shared runtime environment common to C# and F# languages, it's possible to use most of F#'s functional features in C# as well. Author Simon J. Painter explains how you can write functional code in C# right away, without having to install dependencies or features newer than .NET 3. You'll learn why functional programming concepts can bring immediate benefit to your work.
Overall, it's a good book for getting into functional programming, but the code contains minor mistakes that might make you question whether you truly understood the subject.
This is an excellent resource for C# developers who are looking to dive into functional programming (FP) and explore its core concepts. The book serves as a well-structured introduction to FP, tailored specifically for those familiar with object-oriented programming (OOP) in C#. The author does a great job of highlighting the key advantages of FP while drawing clear comparisons to OOP. Through practical examples, readers can easily grasp why and how FP differs from traditional OOP approaches, and when it might be more beneficial. A particularly valuable section of the book is where the author walks through the implementation of functional programming techniques such as the Maybe monad, along with other commonly used FP constructs. These examples are directly applicable and help bridge the gap between theory and practice. One of the standout features is the hands-on demonstration of building a simple game using a functional approach in C#. This example ties everything together and shows how FP can be applied to real-world projects, making it easier for readers to envision using it in their own work. Additionally, the author provides a brief overview of well-known FP libraries available in the .NET ecosystem. This comparison of NuGet packages is a nice touch, offering readers insight into tools they can leverage to enhance their functional programming journey. Overall, this book is a must-read for any C# developer interested in broadening their skills with functional programming principles.
I've tried to learn functional programming in a variety of languages and through a variety of resources over the years. While I ultimately succeeded, I feel like I would have done a far better job learning with this book in my hands. This does its absolute best to remove the fear from functional programming and embrace the practical, then use the concepts to teach more of functional programming terminology.
This is now my default resource to recommend to any .NET dev looking to see how to get started with functional programming in the context of the C# language.