
عنوان:
#Functional Programming with C
نویسنده:
Alex Yagur
انتشارات:
Packt Publishing Pvt Ltd
تاریخ انتشار:
2024
حجم:
3.6MB
معرفی کتاب:"برنامهنویسی تابعی با #C: شکوفایی هوش کدنویسی با جادوی برنامهنویسی تابعی – ویرایش اول "
درباره کتاب
در دنیایی که پیچیدگی نرمافزار روزبهروز افزایش مییابد، برنامهنویسی تابعی الگویی ارائه میدهد که نگهداری کد را سادهتر و قابلیت اطمینان را بیشتر میکند. کتاب «برنامهنویسی تابعی با #C» شما را با اصول بنیادی این پارادایم آشنا کرده و آن را با پارادایمهای دستوری و شیءگرا مقایسه میکند. با استفاده از مثالهای عملی، شما یاد میگیرید که چگونه با بهرهگیری از توابع خالص، توابع مرتبه بالاتر، مدیریت خطا و برنامهنویسی ناهمگام، کدی بیانی، ماژولار و مقاوم بنویسید.
ویژگیهای کلیدی
- تسلط بر برنامهنویسی تابعی در #C برای نوشتن کدی بیانی و ماژولار
- بهکارگیری مفاهیم پیشرفته مانند مدیریت خطا و برنامهنویسی ناهمگام برای حل چالشهای واقعی
- کسب مهارتهای عملی از طریق پیادهسازیهای واقعی و پرسشهای خودارزیابی
آنچه خواهید آموخت
- درک اصول اصلی برنامهنویسی تابعی
- تفاوت میان پارادایمهای تابعی، دستوری و شیءگرا
- نوشتن کد بیانی با توابع مرتبه بالاتر
- مدیریت خطا با تکنیکهای تابعی
- استفاده از برنامهنویسی ناهمگام برای وظایف همزمان
- درک مفاهیم پیشرفته مانند بازگشت و بهخاطرسپاری
مخاطب هدف
این کتاب مناسب توسعهدهندگان متوسط تا پیشرفتهی #C است که میخواهند درک عمیقتری از برنامهنویسی تابعی پیدا کنند. همچنین برای مهندسان نرمافزار و برنامهنویسانی که به دنبال افزایش ماژولار بودن، خوانایی و مقیاسپذیری کد هستند، ایدهآل خواهد بود.
درباره نویسنده
الکس یاگور نویسندهای با تجربه در زمینه برنامهنویسی #C و توسعه نرمافزار است که تخصص ویژهای در تدریس مفاهیم برنامهنویسی تابعی و بهبود کیفیت کد دارد.
فهرست مطالب
- Contributors
- About the author
- About the reviewers
- Preface
- Part 1: Foundations of Functional Programming in C#
- Chapter 1: Getting Started with Functional Programming
- Functional versus imperative versus object-oriented programming
- How functional programming is supported in C#
- How to write functional code in C#
- A practical example – a book publishing system
- How to combine functional and object-oriented paradigms
- Meet Steve and Julia
- Summary
- Chapter 2: Expressions and Statements
- Task 1 – Name and count all expressions and all statements
- Task 2 – Use expressions instead of statements
- Task 3 – Create an expression tree
- Understanding the difference between expressions and statements
- How to use expressions for clear and simple code
- Lambda expressions, expression-bodied members, and anonymous methods
- Expression trees and how to use them to manipulate expressions at runtime
- Guided exercise – constructing and manipulating expression trees
- Problem sets and exercises
- Exercises
- Solutions
- Summary
- Chapter 3: Pure Functions and Side Effects
- Task 1 – Refactoring to a pure function
- Task 2 – Isolating side effects
- Task 3 – Using a Pure attribute
- Understanding pure functions
- Side effects
- Strategies to minimize side effects
- Marking pure functions with the Pure attribute
- Exercises
- Solutions
- Summary
- Chapter 4: Honest Functions, Null, and Option
- Task 1 – Refactor for honest return types
- Task 2 – Guard against null inputs
- Task 3 – Pattern matching with nullable types
- Honest functions – definition and understanding
- The problems with hidden nulls
- Embracing honesty with nullable reference types
- Returning with intention
- Demanding honesty from function inputs
- Pattern matching and nullable types
- The null object pattern
- Beyond null – using Option
- Practical scenarios – handling nulls effectively
- The reality of honesty in C# – why there will never be truly honest functions
- The compromises of the C# language design
- Practical tips and best practices
- Exercises
- Solutions
- Summary
- Part 2: Advanced Functional Techniques
- Chapter 5: Error Handling
- Task 1 – Custom error types and result usage
- Task 2 – Utilizing ROP for validation and processing
- Task 3 – Implementing a Retry mechanism using functional techniques
- Traditional error handling in C#
- The Result type
- Railway-Oriented Programming (ROP)
- Designing your own error-handling mechanisms
- Practical tips for functional error handling
- Traditional versus functional error handling comparison
- Patterns and anti-patterns in functional error handling
- Solutions
- Summary
- Chapter 6: Higher-Order Functions and Delegates
- Task 1 – Sorting function
- Task 2 – Customized calculations
- Task 3 – Comparison
- Understanding higher-order functions
- Delegates, actions, funcs, and predicates
- Callbacks, events, and anonymous methods
- Harnessing LINQ methods as higher-order functions
- Case study – putting it all together
- Best practices and common pitfalls
- Exercises
- Solutions
- Summary
- Chapter 7: Functors and Monads
- Task 1 – Functor usage
- Task 2 – Applicative functor
- Task 3 – Monad usage
- What’s a functor?
- Applicative functors
- Monads
- Key takeaways
- Exercises
- Solutions
- Summary
- Part 3: Practical Functional Programming
- Chapter 8: Recursion and Tail Calls
- Task 1 – Recursive enemy count
- Task 2 – Wave generation
- Task 3 – Asynchronously updating enemy stats
- Introducing recursion
- Recursive thinking
- Types of recursion
- Challenges of recursion
- Leveraging C# features for recursion
- Advanced recursive patterns
- Comparison with iterative solutions
- Recursion in asynchronous programming
- Synchronous versus asynchronous recursion
- Exercises
- Solutions
- Summary
- Chapter 9: Currying and Partial Application
- Task 1 – Currying tower attack functions
- Task 2 – Partial application for game settings
- Task 3 – Currying permission checks for game features
- Understanding currying
- Step-by-step implementation of currying
- Partial application
- Areas for partial application
- Challenges and limitations
- Exercises
- Solutions
- Summary
- Chapter 10: Pipelines and Composition
- Task 1 – Enemy wave processing pipeline
- Task 2 – Game data file processing
- Task 3 – Dynamic SQL query generation using currying and partial application
- Function composition
- Building pipelines
- Performance considerations
- The fluent interface
- Advanced composition with monads
- Exercises
- Solutions
- Summary
- Part 4: Conclusion and Future Directions
- Chapter 11: Reflecting and Looking Ahead
- A summary of the main concepts and techniques
- Comparison with other languages
- Resources for further learning
- Closing thoughts
- Index
- Other Books You May Enjoy
مشخصات
نام کتاب
#Functional Programming with C
نویسنده
Alex Yagur
انتشارات
Packt Publishing Pvt Ltd
تاریخ انتشار
2024
ISBN
9781805122685
تعداد صفحات
239
زبان
انگلیسی
فرمت
حجم
3.6MB
موضوع
Csharp