Functional programming is a way of thinking about programs that emphasizes functions, while avoiding state mutation. It allows us to write elegant, intention-revealing code, that shines in testability and support for concurrency. C# includes a number of functional features and libraries, enabling us to take advantage of these benefits.
Functional Programming in C# teaches you to apply functional thinking to real-world scenarios. You’ll start by learning the principles of functional programming, and how they translate in the C# language. The book then dives into important topics like function composition, data flow, and principles for designing function signatures, types and collections. Through lots of real-world examples, you’ll acquire the tools to tackle programming tasks with a functional approach. The last part of the book deals with advanced topics, including lazy evaluation, stateful computations, asynchrony, and event streams. By the end of this book, you’ll be able to integrate functional techniques, making your C# programs robust and maintainable, and helping you become a more well-rounded developer.
The most useful aspect of this book, in my opinion as a C# programmer, would be the introduction of functional concepts through examples of C#. However, after completing this book I came to the conclusion that C# just isn't the language to perform functional programming in. There are a lot of trials and tribulations that come with attempting to make an object-oriented language perform functional actions, and many of those woes could seemingly be overcome by utilizing a more purpose-driven language like F#, Haskel, or any of the other functional-first languages. There is more than one occasion in which the author mentioned a functional concept that just simply wasn't possible in C#.
If I were to re-write this book (not that I could), I would focus on using idiomatic C# concepts to perform function actions, rather than using more functional concepts. Using `Select` instead of a `Map` function or `SelectMany` rather than `Bind`. While it is mentioned in the books how these concepts are essentially interchangeable, it would simplify my understanding of the concepts if each time I didn't need to perform the translation in my head. It would also be beneficial to use a more established library like `LanguageExt` rather than rolling a custom library (`LaYumba`), which would alleviate some of the tribulations I encountered when attempting to apply these concepts with new vocabulary that didn't match those taught in the author's library.
But on a more uplifting note, I think the book did effectively introduce me to concepts. I found that it didn't give me a deep enough understanding of them that I could effectively use them without much issue (there was a lot of stumbling when I attempted to apply these concepts to a demo application without any handholding). However, it did make me aware of the concepts and help me know what I needed to look up; it gave me a glimpse of the end goal so that I could pave my own way there.
I'm not sure I would recommend this book as a good way to learn a functional language. I think there may be other, better alternatives out there that use C# as a demonstration. However, I don't think I would discourage anyone from trying it and wouldn't try to convince them to pick an alternative if they've already decided on this one. The book was reasonably effective and I cannot fault it for it's ability to introduce concepts.
I've reviewed MEAP 10 version - it seems to contain all the chapters from the final version.
I've got this one as a compensation for cancelled MEAP or something, I didn't really plan to read it as I'm rather reluctant when it comes to OOP lanaguages that try to pretend they are good in FP. Fortunately, I was very pleasantly surprised...
1. Maybe I've just matured that much, but I think that this book contains the most engineer-friendly definition of Monad ever :) What is more, it shows its practicalities & compares Monads to some very similar functional constructs (e.g. applicatives) in very clear AND practical way. But don't expect it to jump into very sophisticated FP theory - it doesn't go significantly further than that (functors, applicatives, traversables, observables, etc.).
2. This book doesn't use any particular FP lib for C#. Everything is being built from scratch, but I don't find it at all as it doesn't really take that much code & it makes all the clarifications much more approachable.
3. There's a very nice chapter about error handling with usage of functional constructs - very well thought & clear. Diagrams were good enough even in the MEAP version I had.
4. Another interesting topic (that has been covered: in chapters 5 & 7) is functional composition in smaller & larger scale. Very few FP book authors approach this topic directly - majority of them focuses on atomic, syntax-level details.
5. I generally rate the final chapters lower (not because they are terrible, but because you can find similar context - e.g. about Rx - in many other sources), but there's one very interesting topic covered there that was really worth waiting for - problem of stacking monads (of different nature) - this is something you (as an FP practitioner) encounter sooner or later, but I haven't seen this covered in any other book.
To summarize: I honestly recommend this book to any C# dev, who'd like to "broaden her/his horizons". If you're into FP, but you're not using C#, don't bother ofc. And no, no, no - I didn't ask you to go & start implementing all this straight away in your production code :)
Hodnocení pro hotovou knihu ====================================== Předběžné hodnocení MEAP verze z 2.8. 2016 - *** MEAP V 10 - **** (chyby v kapitole 15?)
Really mind-bending! (as one of the reviewers wrote) It changed the way I see: throwing Exceptions, ifs, static functions, mutability, nulls. Now I look at "containers" like IEnumerable, Task, Func differently and a lot deeper. It encouraged me to write my own "containers". I see functions (Func) like just any other values. I also found out why LINQ is so readable - because it is the functional part of C#.
The only weak point of the book are its two last chapters (14, 15). In my opinion they seem like chapters taken from completely different book. But it didn't change the way I see the book.
Great content, and overview of some of the functional concepts. But unfortunately I don't see myself using any of the practices any time soon in C#. Unfortunately the author has to fight C# a lot and as a result the code is building on blocks that have overhead associated with it (chaining many Func together), and runs in many different shortcomings of C# generic type inference. Still it is nice to see how some of the problems are solved, and compare solution presented in this book with solutions from other authors, and then with how easy it is to do in a language that was made for functional paradigm.
A very complete guide about functional programming (FP), including some architecture stuff like CQRS, event sourcing and others advanced topics like testing, concurrent and asynchronous programming. All these subjects are addressed using the FP concepts. I recommend this book to C# developers that want to learn how to extract the max from functions, providing a testable and reusable code, FP is much more than LINQ.
I haven't come across a programming book which was a joy to read and just as informative since "Clean Code" by Robert Cecil.
The explanations, examples and personal reasoning for the use of each talking point was fantastic. It is rare to find a programming book which is detailed and not dry. You can tell your reading a book written by someone with real world experience and less like a book meant a "car manual".
The author did a great job of explaining functional concept from an object oriented perspective. He provided lots of examples for each new concept he introduced. The organization and pacing was good too. I am already incorporating these concepts into my code submissions to create more concise and treatable code while minimizing my exposure to bugs.
I have been trying to pick up functional programming for a while, but this is the first piece of learning material which has really made it click for me.
The explanations used are really clear, and it builds on simple concepts from start to finish.
Очень хорошая книга для погружения из императивного мира в функциональный. Очень понятное объяснение базовых концепций на основе C#. Также поясняются недостатки использования C# в функциональном стиле. Очень мало воды, что очень порадовало. В стиле с применением понятных тулов.
Well written and educational for those seeking to improve on their software development skills. I got this as a way to bridge from classical object oriented programming into the world of functional programming. I have read the first half of the book multiple times, but have yet to finish the book.
Just awesome and must read. This book goes to the top of my shelf, Chapter 3 and Chapter 8 are my favorite, it made applicatives, monads and functors super clear.
Excellent book for widening your programming skills!
It is well written and you can follow along really easily. The examples are great and I can immediately think of ways to apply them in my current project.
For me, the main takeaway is that there is a way to write C# code in a way that is terse yet easy to understand, as opposed to writing terse but cryptic code. You do it by preparing a few re-usable functions that then allow you to write boilerplate-free code. And it is exactly that boilerplate-free code that is a delight to read.
Who knows, this might be my jumping board towards that sweet F# salary :D
I'm 2 thirds through the book and I'm already thinking about re-reading it because it is full of nuggets which I don't think I extracted in the first go.
Nice book that shows you how functional concepts could be used in C#. Show problems and weaknesses of C# as language, used for functional. After this book you may have an interest to look at F# as language, which is functional-first
This book has opened my eyes to the world of functional programming and has made me a much better C# developer in the process. The author does a good job of introducing more complex topics and ramping up the complexity slowly throughout the book. This is nice especially when you come from an imperative background. If you are a .NET developer you should buy this book, as it will make you a much better programmer.
As a C# programmer I used LINQ and other stuff and I realize I'm in love with functional programming. My recommendation - this book is highly recommended for ALL C# programmers!