Functional Programming in C#, 2nd Ed (Manning)

Author: Enrico Buonanno
Publisher: Manning
Date: February 2022
Pages: 448
ISBN: 978-1617299827
Print: 1617299820
Kindle: B09P1Z2PPB
Audience: C# developers
Rating: 5
Reviewer: Mike James
Is C# a good language for functional programming?

My personal opinion is that it isn't if you mean hard line academic functional programming - for that you need Haskell or one of the languages designed to be functional from the start. C# is a general multi--paradigm  language, but it has enough functional characteristics for the weekend functional programmer like me. Surely even F# would be a better choice for a book on functional .NET programming? Not necessarily.

The first thing to say is that to augment the functional features of C# a custom library is used and it is difficult to know if this library is up to production code standards. The library is based on another open source library but again it is difficult to know if you can rely on either being around in the future. However this potentially serious defect may not be a defect at all if you actually read and learn from the book. The point is that the book is explaining functional programming at a sufficiently deep level for you to implement your own function extras and know what might go wrong. 

Banner

Part 1 of the book is titled "Getting Started" and it introduces functional programming using LINQ among other things - this is a really good idea. It goes through the basic ideas of functional programming but even if you think you know the basics it is still worth reading carefully as the ideas are described in much better detail than most.  The explanations of using functional programming to simplify concurrency is particularly interesting because it highlights the difficulties of the approach so well.

 Part 2 is  "Core Techniques" and this deals with the idioms of functional programming, how to design functions and use data objects. The section on dealing with Option and Nulls is particularly interesting as it is exactly the sort of thing that throws the beginner. The section on Patterns is also worth reading as it deals with many of the questions that are raised in the mind of the beginner that are often ignored.

Part 3 is on "Functional Design" and, yes, here we get to the infamous monad and by this point it seems all very reasonable rather than something theoretical and unnecessary. So much so that by the time you reach Part 4 "Advanced Techniques" it is difficult to think up what could be still to cover. It covers lazy evaluation, managing state, asynchronous, data streams and message passing.

This book has a lot to offer the existing C# programmer, even if you don't anticipate moving to a functional paradigm in the near future. It's not an easy book to read and it will test your knowledge of C#, but if you stick with it then you will follow much of the rationale and principles of functional programming.

Unlike many other books on functional programming it really does aim to explain and justify rather than simply present an academic view which is simply unassailable because of its credentials. Oh, and you can learn a lot of C# as well as functional programming on the way - highly recommended. 

 

  • Mike James, Founder and Chief Editor of I Programmer is a prolific author. In Deep C#: Dive Into Modern C#, published in September 2021, he provides a “deep dive” into various topics that are important or central to the language. By exploring the motivation behind these key concepts, which is so often ignored in the documentation, the intention is to be thought-provoking and to give developers confidence to exploit C#’s wide range of features.

For recommendation of more books for C# programmers, see the Programmer's Bookshelf Top Choice C# Titles 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Pro Database Migration to Azure

Author: Kevin Kline et al
Publisher: Apress
Pages: 352
ISBN: 978-1484282298
Print: 1484282299
Kindle: B0B924H21P
Audience: Managers & architects
Rating: 4
Reviewer: Ian Stirk

This book aims to give you a holistic approach to migrating on-premise databases to Azure, how does it fare?



GraphQL in Action (Manning)

Author: Samer Buna
Publisher: Manning
Pages: 384
ISBN: 978-1617295683
Print: 161729568X
Audience: Developers interested in GraphQL
Rating: 4.5
Reviewer: Kay Ewbank

GraphQL has achieved impressive popularity as an open-source language for APIs that can be used for querying and manipulating data.&nbs [ ... ]


More Reviews

<ASIN:1871962714>

<ASIN:B09FTLPTP9>

 

Last Updated ( Wednesday, 18 October 2023 )