Applying Functional Principles in C#

Functional programming in C# can give you insight into how your programs will behave. You'll learn the fundamental principles that lie at the foundation of functional programming, why they're important, and how to apply them.
Course info
Rating
(300)
Level
Intermediate
Updated
Apr 8, 2016
Duration
3h 28m
Table of contents
Course Overview
Introduction
Refactoring to an Immutable Architecture
Refactoring Away from Exceptions
Avoiding Primitive Obsession
Avoiding Nulls with the Maybe Type
Handling Failures and Input Errors in a Functional Way
Putting It All Together
Description
Course info
Rating
(300)
Level
Intermediate
Updated
Apr 8, 2016
Duration
3h 28m
Description

With the advent of LINQ, C# has gotten a significant exposure to functional programming. However, functional programming in C# is not restricted to the use of extension methods, lambdas and immutable classes. There are a lot of practices that haven't been adopted as widely because there's not much of native language support for them in C#. Still, they can be extremely beneficial should you incorporate them into your day-to-day work. This course, Applying Functional Principles in C#, will show them to you. You will learn the fundamental principles behind functional programming, why they are important and how to apply them in practice. Specific topics you'll cover include refactoring to an immutable architecture, avoiding exceptions, primitive obsession, how to handles failures and input errors, and more. By the end of this course, you will have a much more comprehensive understanding of why and how to use functional programming.

About the author
About the author

Vladimir Khorikov is a Microsoft MVP and has been professionally involved in software development for more than 10 years.

More from the author
CQRS in Practice
Intermediate
4h 22m
Oct 11, 2018
More courses by Vladimir Khorikov
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Vladimir Khorikov, and welcome to my course Applying Functional Principles in C#. I'm a backend developer and very excited to share this course with you. This course is a description of functional principles that lie at the foundation of functional programming. You will be surprised how simple they are and, at the same time, how many useful practices they entail. Some of the major topics that we will cover include immutable architecture, why nulls are evil and how to fix that, primitive obsession, the use of exceptions, and handling failures and input errors in a functional way. By the end of this course, you will know how to apply all these principles in practice in your own projects. Before beginning the course, you should be familiar with the C# programming language. If not, we have lots of C# courses to choose from on Pluralsight. Please join me on this journey to learn functional principles with the Applying Functional Principles in C# course at Pluralsight.

Introduction
Hi, my name is Vladimir Khorikov, and this the Applying Functional Principles in C# course. With the advent of LINQ, C# has gotten a significant exposure to functional programming. With such features as pattern matching, which is going to be implemented in the future versions, C# will get even more of it. However, functional programming in C# is not restricted to the use of extension methods, lambdas, and immutable classes. There are a lot of practices that haven't been adopted as widely because there is not much of native language support for them in C#. Still, they can be extremely beneficial should you incorporate them into your day-to-day work. In this course, I'm going to show them to you. You will see the fundamental principles behind functional programming, why they are important and how to apply them in practice.

Refactoring to an Immutable Architecture
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Refactoring to an Immutable Architecture. In this module, you will learn why immutability is an important technique and how it helps make the code more readable. You will also see an example of refactoring to an immutable architecture.

Refactoring Away from Exceptions
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Refactoring Away from Exceptions. In this module, you will see how excessive use of exceptions contradicts functional principles and how to refactor your code to avoid that. You will learn what the valid use cases for exceptions are and how to work with exceptions from third-party libraries.

Avoiding Primitive Obsession
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Avoiding Primitive Obsession. In this module, you will learn what primitive obsession is and how it damages code readability. You will see how it contradicts functional programming principles and will learn the techniques that help avoid it.

Avoiding Nulls with the Maybe Type
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Avoiding Nulls with the Maybe Type. In this module, you will learn why nulls are evil and how to deal with them in a functional way.

Handling Failures and Input Errors in a Functional Way
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Handling Failures and Input Errors in a Functional Way. In this module, you will see how to deal with failures using the railway-oriented approach.

Putting It All Together
Hi, my name is Vladimir Khorikov, and this is the Applying Functional Principles in C# course: Putting It All Together. In this module, you will see how to apply the practices we discussed in the previous modules to a real-world application. We will take an ASP. NET Web API application and will refactor it using the principles we talked about earlier. You will see how to make parts of the domain model immutable, how to refactor away from using exceptions to control the program flow, get rid of primitive obsession, deal with nulls, and apply railway-oriented programming. You will also see how to save your domain model to a data store, namely how to convert value objects into primitives and Maybe type instances to nulls when you do that.