Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Functional Programming with C#
  • Table Of Contents Toc
  • Feedback & Rating feedback
Functional Programming with C#

Functional Programming with C#

By : Alex Yagur
close
close
Functional Programming with C#

Functional Programming with C#

By: Alex Yagur

Overview of this book

In an era where software complexity is increasing by the day, functional programming offers a paradigm that simplifies code maintenance and enhances reliability. Functional Programming with C# takes you on an exhaustive journey into functional programming within C#. The book familiarizes you with the core principles and benefits of functional programming, juxtaposing it with imperative and object-oriented paradigms. You’ll get to grips with the functional features of C# and learn to write expressive, modular code through expressions, pure functions, and higher-order functions. As you advance, you’ll explore advanced concepts such as error handling and asynchronous programming, which will equip you with the practical skills that you need to tackle real-world challenges. By comparing functional programming in C# with other languages and providing additional resources, this book ensures that you’re well-equipped to continue your journey toward mastery in functional programming. By the end of this book, you’ll have gained a thorough understanding of functional programming techniques, such as recursion, memoization, and composition, empowering you to write robust, maintainable code.
Table of Contents (18 chapters)
close
close
Free Chapter
1
Part 1:Foundations of Functional Programming in C#
6
Part 2:Advanced Functional Techniques
10
Part 3:Practical Functional Programming
14
Part 4:Conclusion and Future Directions

Side effects

While working on his tower defense game, Steve noticed some unexpected behavior. Units were taking inconsistent damage from towers. After some investigation, he realized the damage calculation function relied on a global variable that could change unpredictably - a classic side effect.

Side effects in programming refer to any application state changes that occur outside the function being executed. These changes could include modifying a global or static variable, changing the original value of function parameters, performing I/O operations, or even throwing an exception. Side effects make the behavior of a function dependent on the context, reducing predictability and potentially increasing bugs.

Common sources of side effects

When writing code, it’s good to know where side effects might come from. Side effects can make code unpredictable. Let’s break down some common sources.

Global variables

Problem: Using global variables can lead to unexpected...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY