Functional Programming with C# - Helion
ISBN: 9781492097037
stron: 328, Format: ebook
Data wydania: 2023-09-12
Księgarnia: Helion
Cena książki: 29,90 zł (poprzednio: 299,00 zł)
Oszczędzasz: 90% (-269,10 zł)
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.
- Learn what functional programming is and how it originated
- Discover features of the functional paradigm using a more familiar language
- Start coding functionally in C# right away, without relying on third-party libraries
- Write code that's more robust, less error prone, and easier to test
- Examine less conventional ways to look at structures available in C#
- Explore the practicalities of using functional C# in a business environment
Osoby które kupowały "Functional Programming with C#", wybierały także:
- Cisco CCNA 200-301. Kurs video. Administrowanie bezpieczeństwem sieci. Część 3 665,00 zł, (39,90 zł -94%)
- Cisco CCNA 200-301. Kurs video. Administrowanie urządzeniami Cisco. Część 2 665,00 zł, (39,90 zł -94%)
- Cisco CCNA 200-301. Kurs video. Podstawy sieci komputerowych i konfiguracji. Część 1 665,00 zł, (39,90 zł -94%)
- Impact of P2P and Free Distribution on Book Sales 427,14 zł, (29,90 zł -93%)
- Cisco CCNP Enterprise 350-401 ENCOR. Kurs video. Programowanie i automatyzacja sieci 443,33 zł, (39,90 zł -91%)
Spis treści
Functional Programming with C# eBook -- spis treści
- Preface
- Who Should Read This Book?
- Why I Wrote This Book
- Navigating This Book
- Conventions Used in This Book
- Using Code Examples
- OReilly Online Learning
- How to Contact Us
- Acknowledgments
- 1. Introduction
- What Is Functional Programming?
- Is It a Language, an API, or What?
- The Properties of Functional Programming
- Immutability
- Higher-order functions
- Expressions rather than statements
- Expression-based programming
- Referential transparency
- Recursion
- Seriously, recursion
- Pattern matching
- Stateless
- Baking Cakes
- An Imperative Cake
- A Declarative Cake
- Where Does Functional Programming Come From?
- Who Else Does Functional Programming?
- Pure Functional Languages
- Is It Worth Learning a Pure Functional Language First?
- What About F#? Should I Be Learning F#?
- Multiparadigm Languages
- The Benefits of Functional Programming
- Concise
- Testable
- Robust
- Predictable
- Better Support for Concurrency
- Reduced Code Noise
- The Best Places to Use Functional Programming
- Where You Should Consider Using Other Paradigms
- How Far Can We Take This?
- Monads Actually, Dont Worry About This Yet
- Summary
- What Is Functional Programming?
- I. What Are We Already Doing?
- 2. What Can We Do Already?
- Getting Started
- Writing Your First Functional Code
- A Nonfunctional Film Query
- A Functional Film Query
- Focusing on Results-Oriented Programming
- Understanding Enumerables
- Preferring Expressions to Statements
- The Humble Select
- Iterator value is required
- No starting array
- Many to One: The Subtle Art of Aggregation
- Customized Iteration Behavior
- The Humble Select
- Making Your Code Immutable
- Putting It All Together: A Complete Functional Flow
- Taking It Further: Develop Your Functional Skills
- Summary
- 3. Functional Coding in C# 7 and Beyond
- Tuples
- Pattern Matching
- Procedural Bank Accounts
- Pattern Matching in C# 7
- Pattern Matching in C# 8
- Pattern Matching in C# 9
- Pattern Matching in C# 10
- Pattern Matching in C# 11
- Read-Only Structs
- Init-Only Setters
- Record Types
- Nullable Reference Types
- The Future
- Discriminated Unions
- Active Patterns
- Summary
- 4. Work Smart, Not Hard with Functional Code
- Its Time to Get Func-y
- Funcs in Enumerables
- A Super-Simple Validator
- Pattern Matching for Old Versions of C#
- Make Dictionaries More Useful
- Parsing Values
- Custom Enumerations
- Query Adjacent Elements
- Iterate Until a Condition Is Met
- Summary
- Its Time to Get Func-y
- II. Into the Belly of the Functional
- 5. Higher-Order Functions
- A Problem Report
- Thunks
- Chaining Functions
- Fork Combinator
- Alt Combinator
- Compose
- Transduce
- Tap
- Try/Catch
- Handling Nulls
- Update an Enumerable
- Summary
- 6. Discriminated Unions
- Holiday Time
- Holidays with Discriminated Unions
- Schrödingers Union
- Naming Conventions
- Database Lookup
- Sending Email
- Console Input
- Generic Unions
- Maybe
- Result
- Maybe Versus Result
- Either
- Summary
- 7. Functional Flow
- Maybe, Revisited
- Maybe and Debugging
- Map() Versus Bind()
- Maybe and the Primitives
- Maybe and Logging
- Maybe and Async
- Nested Maybes
- The Laws
- Left Identity Law
- Right Identity Law
- Associativity Law
- Reader
- State
- Maybe a State?
- Examples Youre Already Using
- Enumerable
- Task
- Other Structures
- A Worked Example
- Summary
- Maybe, Revisited
- 8. Currying and Partial Application
- Currying and Large Functions
- Currying and Higher-Order Functions
- Currying in .NET
- Partial Application
- Partial Application in .NET
- Summary
- 9. Indefinite Loops
- Recursion
- Trampolining
- Custom Iterator
- Understanding the Anatomy of an Enumerator
- Implementing Custom Enumerators
- Indefinitely Looping Enumerables
- Using Indefinite Iterators
- Summary
- 10. Memoization
- Bacon Numbers
- Implementing Memoization in C#
- Summary
- III. And Out the Other Side
- 11. Practical Functional C#
- Functional C# and Performance
- Baseline: An Imperative Solution
- Performance Results
- Imperative baseline results
- Definite loop solutions
- Indefinite loop solutions
- Interop with F# performance
- External factors and performance
- What Does All of This Mean?
- Functional C# Concerns and Questions
- How Functional Should I Make My Codebase?
- How Should I Structure a Functional C# Solution?
- How Do I Share My Functional Methods Among Applications?
- Did You Order This Pizza?
- How Do I Convince My Teammates to Do This Too?
- Is It Worth Including F# Projects in My Solution?
- Will Functional Coding Solve All My Problems?
- Connery, Moore, or Craig?
- How Do I Think Through a Problem Functionally?
- What If Theres No Way to Make a Bit of Code as High-Performant as Id Like with Functional-Style Code?
- Summary
- Functional C# and Performance
- 12. Existing Functional Programming Libraries in NuGet
- OneOf
- LanguageExt
- Option
- Either
- Memoization
- Reader
- State
- LanguageExt Wrap-up
- Functional.Maybe
- CSharpFunctionalExtensions
- Maybe
- Result
- Fluent Assertions
- CSharpFunctionalExtensions Wrap-up
- The F# Programming Language
- Summary
- 13. The Martian Trail
- Story
- Technical Detail
- Creating the Game
- The Solution
- Communications
- Want to Learn How to Play?
- The Inventory Setup
- The Game Loop
- Creating a weather report
- Choosing what to do this turn
- Updating progress
- Summary
- 14. Conclusion
- What Kind of Day Has It Been?
- Where Do I Go from Here?
- More Functional C#
- Learn F#
- Pure Functional Languages
- What About You?
- Index