
Functional Programming in C#, 2nd Edition
- Length: 448 pages
- Edition: 2
- Language: English
- Publisher: Manning
- Publication Date: 2022-01-25
- ISBN-10: 1617299820
- ISBN-13: 9781617299827
- Sales Rank: #2506597 (See Top 100 Books)
see url Real world examples and practical techniques for functional programming in C# without the jargon and theory.
In Buy Soma London Functional Programming in C#, Second Edition you will learn how to:
- Use higher-order functions to reduce duplication and do more with less code
- Use pure functions to write code that is easy to test and optimize
- Write pleasant APIs that accurately describe your program’s behavior
- Use dedicated types to handle nullability, system errors, and validation rules predictably and elegantly
- Write composable code without the overhead of an IoC container
Clonazepam Discount Price Functional Programming in C# has helped thousands of developers apply functional thinking to C# code. Its practical examples and spot-on treatment of FP concepts makes it the perfect guide for proficient C# programmers. This second edition is fully revised to cover new functional-inspired features in the most recent releases of C#, including tuples, async streams, pattern matching, and records. Each chapter is packed with awesome perspectives and epiphany moments on how functional programming can change the way you code.
Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.
get link About the technology
Turbocharge your C# code. Good functional techniques will improve concurrency, state management, event handling, and maintainability of your software. This book gives you practical answers to why, how, and where to add functional programing into your C# coding practice.
https://kanchisilksarees.com/pc80aa7ao About the book
https://audiopronews.com/headlines/8szdzo9e Functional Programming in C#, Second Edition teaches functional thinking for real-world problems. It reviews the C# language features that allow you to program functionally and through many practical examples shows the power of function composition, data-driven programming, and immutable data structures. All code examples work with .NET 6 and C# 10.
https://www.masiesdelpenedes.com/g31kt2clj What’s inside
- Higher-order functions reduce duplication and do more with less code
- Code based on pure functions is easy to test and optimize
- Write pleasant APIs that accurately describe your program’s behavior
Write a Web API in a functional style - Monadic composition with LINQ
see url About the reader
For intermediate C# programmers.
click About the author
https://mhco.ca/j33qcf7 Enrico Buonanno studied Computer Science at Columbia University and has over 15 years of experience as a developer, architect, and trainer.
inside front cover Praise for the first edition Functional Programming in C# Copyright contents front matter preface acknowledgments about this book Who should read this book? How this book is organized: A road map Coding for real-world applications Leveraging functional libraries About the code liveBook discussion forum about the author Part 1. Getting started 1 Introducing functional programming 1.1 What is this thing called functional programming? 1.1.1 Functions as first-class values 1.1.2 Avoiding state mutation 1.1.3 Writing programs with strong guarantees 1.2 How functional a language is C#? 1.2.1 The functional nature of LINQ 1.2.2 Shorthand syntax for coding functionally 1.2.3 Language support for tuples 1.2.4 Pattern matching and record types 1.3 What you will learn in this book Summary 2 Thinking in functions 2.1 What’s a function, anyway? 2.1.1 Functions as maps 2.1.2 Representing functions in C# 2.2 Higher-order functions (HOFs) 2.2.1 Functions that depend on other functions 2.2.2 Adapter functions 2.2.3 Functions that create other functions 2.3 Using HOFs to avoid duplication Exercises Summary 3 Why function purity matters 3.1 What is function purity? 3.1.1 Purity and side effects 3.1.2 Strategies for managing side effects 3.1.3 Avoid mutating arguments 3.2 Enabling parallelization by avoiding state mutation 3.2.1 Pure functions parallelize well 3.2.2 Parallelizing impure functions 3.2.3 Avoiding state mutation 3.3 Purity and testability 3.3.1 Isolating I/O effects 3.3.2 A business validation scenario 3.3.3 Why testing impure functions is hard 3.4 Testing code that performs I/O 3.4.1 Object-oriented dependency injection 3.4.2 Testability without so much boilerplate 3.5 Purity and the evolution of computing Exercises Summary Part 2. Core techniques 4 Designing function signatures and types 4.1 Designing function signatures 4.1.1 Writing functions signatures with arrow notation 4.1.2 How informative is a signature? 4.2 Capturing data with data objects 4.2.1 Primitive types are often not specific enough 4.2.2 Constraining inputs with custom types 4.2.3 Writing honest functions 4.2.4 Composing values into complex data objects 4.3 Modeling the absence of data with Unit 4.3.1 Why void isn’t ideal 4.3.2 Bridging the gap between Action and Func Summary 5 Modeling the possible absence of data 5.1 The bad APIs you use every day 5.2 An introduction to the Option type 5.3 Implementing Option 5.3.1 An idealized implementation of Option 5.3.2 Consuming an Option 5.3.3 Creating a None 5.3.4 Creating a Some 5.3.5 Optimizing the Option implementation 5.4 Option as the natural result type of partial functions 5.4.1 Parsing strings 5.4.2 Looking up data in a collection 5.4.3 The smart constructor pattern 5.5 Dealing with null 5.5.1 Why null is such a terrible idea 5.5.2 Gaining robustness by using Option instead of null 5.5.3 Non-nullable reference types? 5.5.4 Bulletproof against NullReferenceException Exercises Summary 6 Patterns in functional programming 6.1 Applying a function to a structure’s inner values 6.1.1 Mapping a function onto a sequence 6.1.2 Mapping a function onto an Option 6.1.3 How Option raises the level of abstraction 6.1.4 Introducing functors 6.2 Performing side effects with ForEach 6.3 Chaining functions with Bind 6.3.1 Combining Option-returning functions 6.3.2 Flattening nested lists with Bind 6.3.3 Actually, it’s called a monad 6.3.4 The Return function 6.3.5 Relationship between functors and monads 6.4 Filtering values with Where 6.5 Combining Option and IEnumerable with Bind 6.6 Coding at different levels of abstraction 6.6.1 Regular vs. elevated values 6.6.2 Crossing levels of abstraction 6.6.3 Map vs. Bind, revisited 6.6.4 Working at the right level of abstraction Exercises Summary 7 Designing programs with function composition 7.1 Function composition 7.1.1 Brushing up on function composition 7.1.2 Method chaining 7.1.3 Composition in the elevated world 7.2 Thinking in terms of data flow 7.2.1 Using LINQ’s composable API 7.2.2 Writing functions that compose well 7.3 Programming workflows 7.3.1 A simple workflow for validation 7.3.2 Refactoring with data flow in mind 7.3.3 Composition leads to greater flexibility 7.4 An introduction to functional domain modeling 7.5 An end-to-end server-side workflow 7.5.1 Expressions vs. statements 7.5.2 Declarative vs. imperative 7.5.3 The functional take on layering Exercises Summary Part 3. Functional designs 8 Functional error handling 8.1 A safer way to represent outcomes 8.1.1 Capturing error details with Either 8.1.2 Core functions for working with Either 8.1.3 Comparing Option and Either 8.2 Chaining operations that may fail 8.3 Validation: A perfect use case for Either 8.3.1 Choosing a suitable representation for errors 8.3.2 Defining an Either-based API 8.3.3 Adding validation logic 8.4 Representing outcomes to client applications 8.4.1 Exposing an Option-like interface 8.4.2 Exposing an Either-like interface 8.4.3 Returning a result DTO 8.5 Variations on the Either theme 8.5.1 Changing between different error representations 8.5.2 Specialized versions of Either 8.5.3 Refactoring to Validation and Exceptional 8.5.4 Leaving exceptions behind? Exercises Summary 9 Structuring an application with functions 9.1 Partial application: Supplying arguments piecemeal 9.1.1 Manually enabling partial application 9.1.2 Generalizing partial application 9.1.3 Order of arguments matters 9.2 Overcoming the quirks of method resolution 9.3 Curried functions: Optimized for partial application 9.4 Creating a partial-application-friendly API 9.4.1 Types as documentation 9.4.2 Particularizing the data access function 9.5 Modularizing and composing an application 9.5.1 Modularity in OOP 9.5.2 Modularity in FP 9.5.3 Mapping functions to API endpoints 9.5.4 Comparing the two approaches 9.6 Reducing a list to a single value 9.6.1 LINQ’s Aggregate method 9.6.2 Aggregating validation results 9.6.3 Harvesting validation errors Exercises Summary 10 Working effectively with multi-argument functions 10.1 Function application in the elevated world 10.1.1 Understanding applicatives 10.1.2 Lifting functions 10.1.3 An introduction to property-based testing 10.2 Functors, applicatives, and monads 10.3 The monad laws 10.3.1 Right identity 10.3.2 Left identity 10.3.3 Associativity 10.3.4 Using Bind with multi-argument functions 10.4 Improving readability by using LINQ with any monad 10.4.1 Using LINQ with arbitrary functors 10.4.2 Using LINQ with arbitrary monads 10.4.3 The LINQ clauses let, where, and others 10.5 When to use Bind vs. Apply 10.5.1 Validation with smart constructors 10.5.2 Harvesting errors with the applicative flow 10.5.3 Failing fast with the monadic flow Exercises Summary 11 Representing state and change 11.1 The pitfalls of state mutation 11.2 Understanding state, identity, and change 11.2.1 Some things never change 11.2.2 Representing change without mutation 11.3 Using records to capture the state of domain entities 11.3.1 Fine-grained control on record initialization 11.3.2 Immutable all the way down 11.4 Separating data and logic Summary 12 A short introduction to functional data structures 12.1 The classic functional linked list 12.1.1 Common list operations 12.1.2 Modifying an immutable list 12.1.3 Destructuring any IEnumerable 12.2 Binary trees 12.2.1 Common tree operations 12.2.2 Structure sharing 12.3 In conclusion Exercises Summary 13 Event sourcing: A functional approach to persistence 13.1 Thinking functionally about data storage 13.1.1 Why data storage should be append-only 13.1.2 Relax and forget about storing state 13.2 Event sourcing basics 13.2.1 Representing events 13.2.2 Persisting events 13.2.3 Representing state 13.2.4 Representing state transitions 13.2.5 Reconstructing the current state from past events 13.3 Architecture of an event-sourced system 13.3.1 Handling commands 13.3.2 Handling events 13.3.3 Adding validation 13.3.4 Creating views of the data from events 13.4 Comparing different approaches to immutable storage 13.4.1 Datomic vs. Event Store 13.4.2 How event-driven is your domain? Summary Part 4. Advanced techniques 14 Lazy computations, continuations, and the beauty of monadic composition 14.1 The virtue of laziness 14.1.1 Lazy APIs for working with Option 14.1.2 Composing lazy computations 14.2 Exception handling with Try 14.2.1 Representing computations that may fail 14.2.2 Safely extracting information from a JSON object 14.2.3 Composing computations that may fail 14.2.4 Monadic composition: What does it mean? 14.3 Creating a middleware pipeline for DB access 14.3.1 Composing functions that perform setup/teardown 14.3.2 A recipe against the pyramid of doom 14.3.3 Capturing the essence of a middleware function 14.3.4 Implementing the query pattern for middleware 14.3.5 Adding middleware that times the operation 14.3.6 Adding middleware that manages a DB transaction Summary 15 Stateful programs and stateful computations 15.1 Programs that manage state 15.1.1 Caching data in memory 15.1.2 Refactoring for testability and error handling 15.1.3 Stateful computations 15.2 A language for generating random data 15.2.1 Generating random integers 15.2.2 Generating other primitives 15.2.3 Generating complex structures 15.3 A general pattern for stateful computations Summary 16 Working with asynchronous computations 16.1 Asynchronous computations 16.1.1 The need for asynchrony 16.1.2 Representing asynchronous operations with Task 16.1.3 Task as a container for a future value 16.1.4 Handling failure 16.1.5 An HTTP API for currency conversion 16.1.6 If it fails, try a few more times 16.1.7 Running asynchronous operations in parallel 16.2 Async streams 16.2.1 Reading from a file as an async stream 16.2.2 Consuming async streams functionally 16.2.3 Consuming data from several streams 16.2.4 Aggregation and sorting with async streams Summary 17 Traversable and stacked monads 17.1 Traversables: Working with lists of elevated values 17.1.1 Validating a list of values with monadic Traverse 17.1.2 Harvesting validation errors with applicative Traverse 17.1.3 Applying multiple validators to a single value 17.1.4 Using Traverse with Task to await multiple results 17.1.5 Defining Traverse for single-value structures 17.2 Combining asynchrony and validation (or any other two monadic effects) 17.2.1 The problem of stacked monads 17.2.2 Reducing the number of effects 17.2.3 LINQ expressions with a monad stack Summary 18 Data streams and the Reactive Extensions 18.1 Representing data streams with IObservable 18.1.1 A sequence of values in time 18.1.2 Subscribing to an IObservable 18.2 Creating IObservables 18.2.1 Creating a timer 18.2.2 Using Subject to tell an IObservable when it should signal 18.2.3 Creating IObservables from callback-based subscriptions 18.2.4 Creating IObservables from simpler structures 18.3 Transforming and combining data streams 18.3.1 Stream transformations 18.3.2 Combining and partitioning streams 18.3.3 Error handling with IObservable 18.3.4 Putting it all together 18.4 Implementing logic that spans multiple events 18.4.1 Detecting sequences of pressed keys 18.4.2 Reacting to multiple event sources 18.4.3 Notifying when an account becomes overdrawn 18.5 When should you use IObservable? Summary 19 An introduction to message-passing concurrency 19.1 The need for shared mutable state 19.2 Understanding message-passing concurrency 19.2.1 Implementing agents in C# 19.2.2 Getting started with agents 19.2.3 Using agents to handle concurrent requests 19.2.4 Agents vs. actors 19.3 Functional APIs, agent-based implementations 19.3.1 Agents as implementation details 19.3.2 Hiding agents behind a conventional API 19.4 Message-passing concurrency in LOB applications 19.4.1 Using an agent to synchronize access to account data 19.4.2 Keeping a registry of accounts 19.4.3 An agent is not an object 19.4.4 Putting it all together Summary Appendix A. Working with previous version of C# A.1 Immutable data objects before C# 9 A.1.1 Immutability by convention A.1.2 Defining copy methods A.1.3 Enforcing immutability A.1.4 Immutable all the way down A.1.5 Copy methods without boilerplate? A.1.6 Comparing strategies for immutability A.2 Pattern matching before C# 8 A.2.1 C#'s incremental support for pattern matching A.2.2 A custom solution for pattern matching expressions A.3 Revisiting the event sourcing example A.4 In conclusion Epilogue. What next? index
1. Disable the Tramadol Buy Cod AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.