Create More Supportable, Robust, and Testable Code
Simon J. Painter
Csharp#
.NET#
Java#
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.
Table of Contents
Chapter 1. Introduction
Part I. What Are We Already Doing?
Chapter 2. What Can We Do Already?
Chapter 3. Functional Coding in C# 7 and Beyond
Chapter 4. Work Smart, Not Hard with Functional Code
Part II. Into the Belly of the Functional
Chapter 5. Higher-Order Functions
Chapter 6. Discriminated Unions
Chapter 7. Functional Flow
Chapter 8. Currying and Partial Application
Chapter 9. Indefinite Loops
Chapter 10. Memoization
Part Ill. And Out the Other Side
Chapter 11. Practical Functional C#
Chapter 12. Existing Functional Programming Libraries in NuGet
Chapter 13. The Martian Trail
Chapter 14. Conclusion
This book introduces all the fundamental concepts of FP, demonstrates their benefits, and describes how they might be achieved in C#—not just for your own hobby programming, but with a real eye toward bringing immediate benefit to your work life as well.
These benefits include things such as the following:
All this and more!
Who Should Read This Book?
This book is intended for developers—whether professional, student, or hobbyist—who already have a basic grounding in C#. You don’t need to be an expert but do need to be familiar with the basics and feel comfortable putting together at least a relatively simply C# application.
Some more advanced .NET topics are covered, but I’ll provide explanations when they come up.
This book has been written with a few categories of people in mind:
Simon J. Painter has been developing professionally for far, far too long now (well, since 2005) and has worked with every version of .NET ever released (including Compact Framework - remember that?) in around a dozen different industries. As well as his day job, he also appears regularly at user groups and conferences to give talks on Functional Programming and general .NET topics. Before becoming a professional, Simon had been a coding enthusiast since he was old enough to read his Dad's copy of the Sinclair ZX Spectrum BASIC handbook. Besides code, he loves Music, Cryptic Crosswords, Fighting Fantasy Gamebooks and far more coffee than is likely to be healthy for him. He lives in a small town in the UK, with his wife and children.