Introducing functional programming using C# : leveraging a new perspective for OOP developers /
Understand the power of C#, a multi-paradigm language. This book will help you learn, analyze, and harness the functional aspects of C# so you can create a better program. The book is divided into two parts. Part I starts with an overview of functional programming (FP). It covers the building blocks...
Clasificación: | Libro Electrónico |
---|---|
Autor principal: | |
Formato: | eBook |
Idioma: | Inglés |
Publicado: |
Berkeley, CA :
Apress L. P.,
2023.
|
Temas: | |
Acceso en línea: | Texto completo (Requiere registro previo con correo institucional) |
Tabla de Contenidos:
- Intro
- Table of Contents
- About the Author
- About the Technical Reviewers
- Acknowledgments
- Introduction
- How Is This Book Organized?
- Prerequisite Knowledge
- Who Is This Book For?
- Useful Software
- Guidelines for Using This Book
- Source Code
- Conventions Used in This Book
- Final Words
- Part I: Getting Familiar with Functional Programming
- Chapter 1: Functional Programming Overview
- C# Supports Multiple Paradigms
- Functions and Methods Are Equivalent in C#
- QA Session
- Important Characteristics of FP
- FP Treats Functions as First-Class Citizens
- Demonstration 1
- Output
- Analysis
- FP Prefers Immutability
- Demonstration 2
- Output
- Q&A Session
- Demonstration 3
- Output
- Analysis
- FP Prefers Pure Functions
- Demonstration 4
- Output
- Discussion of Side Effects
- Functions with I/O
- Are Side Effects Bad?
- Q&A Session
- FP Follows a Declarative Style
- Demonstration 5
- Output
- Demonstration 6
- Output
- Q&A Session
- Demonstration 7
- Output
- FP vs. OOP
- FP Benefits
- Q&A Session
- Exercises
- Summary
- Solutions to Exercises
- E1.1
- E1.2
- E1.3
- E1.4
- E1.5
- E1.6
- E1.7
- E1.8
- Chapter 2: Understanding Functions
- Mathematical Background of Functions
- Mathematical Functions vs. C# Functions
- Representing Functions in C#
- Using Static Methods
- Demonstration 1
- Output
- Simplifying the Code
- QA Session
- Using Delegates and Lambdas
- A Quick Review
- Demonstration 2
- Output
- Additional Note
- Using a Dictionary
- Demonstration 3
- Output
- QA Session
- Demonstration 4
- Built-in Delegates Are Important
- Higher-Order Function
- Custom HOF
- Demonstration 5
- Output
- Additional Note
- Built-in HOF
- Demonstration 6
- Output
- Analysis
- First-Order Function
- Refactoring Impure Functions
- Program with Impurities
- Demonstration 7
- Output
- Removing Impurities
- Demonstration 8
- Output
- Additional Note
- Q&A Session
- Exercises
- Summary
- Solutions to Exercises
- E2.1
- E2.2
- E2.3
- E2.4
- E2.5
- E2.6
- Chapter 3: Understanding Immutability
- What Is Immutability?
- Immutable Objects in .NET
- Q&A Session
- Reviewing Mutable Types
- Programming with a Mutable Type
- Demonstration 1
- Output
- Analysis
- The Path Toward Immutability
- Achieving External Immutability
- Demonstration 2
- Output
- Enforcing Internal Immutability
- Demonstration 3
- Output
- Better Code Using Modern Features
- Demonstration 4
- Output
- Q&A Session
- More on Immutability
- Understanding Shallow Immutability
- Demonstration 5
- Output
- Analysis
- Searching for a Solution
- Demonstration 6
- Output
- Analysis
- Making a Better Solution
- Demonstration 7
- Output
- Analysis
- Implementing Popsicle Immutability
- Demonstration 8
- Output
- Analysis
- Q&A Session
- Exercises
- Summary
- Solutions to Exercises
- E3.1
- E3.2
- E3.3
- E3.4
- E3.5