
عنوان:
Functional Programming in Java (2nd Edition)
نویسنده:
Venkat Subramaniam
انتشارات:
The Pragmatic Bookshelf, LLC
تاریخ انتشار:
2023
حجم:
2.02MB
معرفی کتاب:"برنامهنویسی تابعی در جاوا (Functional Programming in Java, 2nd Edition) "
تصور کنید که در حال نوشتن کد جاوا هستید که درست مانند بیان مسئله خوانده میشود؛ کدی که بیانگر، مختصر، خوانا و قابل اصلاح باشد و پیچیدگی کمتری داشته باشد. با قابلیتهای برنامهنویسی تابعی در جاوا، این تنها یک خیال نیست.
این کتاب شما را از سبک دستوری (imperative) آشنا به جنبههای عملی برنامهنویسی تابعی هدایت میکند و مثالهای فراوانی ارائه میدهد. با استفاده از تکنیکهای آموختهشده، میتوانید کدهای پیچیده دستوری را به کدهای تابعی ساده و قابل فهم تبدیل کنید. این ویرایش به آخرین نسخه جاوا بهروزرسانی شده و شامل چهار فصل جدید درباره مدیریت خطا، بازسازی به سبک تابعی، تبدیل دادهها و اصطلاحات برنامهنویسی تابعی است.
به جای مبارزه با محدودیتهای سبک دستوری، یاد بگیرید که برنامهنویسی شیءگرا و تابعی را ترکیب کنید تا پیچیدگیهای تصادفی کاهش یابد. از قابلیتهای برنامهنویسی تابعی جاوا بهره ببرید تا برنامهای بنویسید که نیت خود را آشکار کند و تیم شما بتواند سریع کد را در جهت تغییرات کسبوکار اصلاح کند.
با عبارات Lambda و API جریانها (Streams)، کدهای پراکنده و پیچیده را به کدی مختصر، بیانگر، زیبا و قابل نگهداری تبدیل کنید. همچنین، یاد بگیرید که چگونه Streams فرآیند اجرای موازی کد را بهسادگی فعال کند تا سرعت و کارایی افزایش یابد.
در این کتاب خواهید آموخت:
- اعمال الگوهای طراحی مبتنی بر Lambda
- مدیریت ایمن منابع
- استفاده از Memoization
- تبدیل دادهها به فرمهای مختلف، با رعایت غیرقابل تغییر بودن (immutability) و ایمنی نخها (thread safety)
- بهرهگیری از ارزیابی تنبل (lazy evaluation) برای کارایی و اجرای موازی برای عملکرد بهتر
- فراتر رفتن از مبانی و یادگیری اصطلاحات برنامهنویسی تابعی
- بازسازی کدهای قدیمی به سبک تابعی و یادگیری تفکر تابعی
- مدیریت خطاها به روش تابعی
این کتاب به جای غرق شدن در نظریه، شما را با تکنیکهای عملی برنامهنویسی تابعی آشنا میکند تا بتوانید کدهای جاوای برتر ایجاد کنید.
نیازمندیها: نسخه جاوا 8 یا بالاتر.
فهرست مطالب
- Foreword to the First Edition
- Acknowledgments
- Preface
- Chapter 1: Hello, Lambda Expressions!
- Change the Way You Think
- The Big Gains of Functional-Style Code
- Why Code in the Functional Style?
- Evolution, Not Revolution
- A Little Sugar to Sweeten
- Wrapping Up
- Chapter 2: Using Collections
- Iterating through a List
- Transforming a List
- Finding Elements
- Skipping Values
- Terminating Iterations
- Reusing Lambda Expressions
- Using Lexical Scoping and Closures
- Picking an Element
- Reducing a Collection to a Single Value
- Joining Elements
- Wrapping Up
- Chapter 3: Strings, Comparators, and Filters
- Iterating a String
- Implementing the Comparator Interface
- Multiple and Fluent Comparisons
- Using the collect Method and the Collectors Class
- Listing All Files in a Directory
- Listing Select Files in a Directory
- Listing Immediate Subdirectories Using flatMap
- Watching a File Change
- Wrapping Up
- Chapter 4: Transforming Data
- Computing Statistics
- When to Use map vs. flatMap
- Checking for Criteria
- Partitioning a Collection
- Counting Occurrences
- Summing Values
- Using flatMapping and filtering
- Teeing Operations
- Wrapping Up
- Chapter 5: Designing with Lambda Expressions
- Separating Concerns Using Lambda Expressions
- Delegating Using Lambda Expressions
- Decorating Using Lambda Expressions
- A Peek into the default Methods
- Creating Fluent Interfaces Using Lambda Expressions
- Wrapping Up
- Chapter 6: Working with Resources
- Cleaning Up Resources
- Using the Execute Around Method Pattern to Clean Up Resources
- Managing Locks
- Creating Concise Exception Tests
- Wrapping Up
- Chapter 7: Being Lazy
- Delayed Initialization
- Lazy Evaluations
- Leveraging the Laziness of Streams
- Creating Infinite, Lazy Collections
- Wrapping Up
- Chapter 8: Optimizing Recursions
- Using Tail-Call Optimization
- Speeding Up with Memoization
- Wrapping Up
- Chapter 9: Composing Functions with Lambda Expressions
- Using Function Composition
- Using MapReduce
- Taking a Leap to Parallelize
- Wrapping Up
- Chapter 10: Error Handling
- Taking a Holistic View of Error Handling
- Exception Handling and Imperative Style
- Checked Exceptions and Functional Style with Streams
- Exception Handling vs. Functional Style
- Dealing with It Downstream
- Handling Failures in Functional Programming
- Wrapping Up
- Chapter 11: Refactoring to Functional Style
- Creating a Safety Net for Refactoring
- Refactoring the Traditional for Loop
- Refactoring More Complex Loops
- Refactoring Unbounded Loops
- Refactoring for-each
- Refactoring to Rework the Logic
- Refactoring File Processing
- Refactoring Data Grouping Operations
- Refactoring Nested Loops
- Real-World Refactoring
- Wrapping Up
- Chapter 12: Functional Programming Idioms
- Don’t Write Dense Lambda Expressions
- Prefer Method References
- Properly Structure the Functional Pipeline
- Keep Separate Conditions in Separate Filters
- Provide Good Domain-Specific Parameter Names
- Use Type Inference for Parameters
- Side Effects in Functional Pipelines
- Wrapping Up
- Chapter 13: Bringing It All Together
- Essential Practices to Succeed with the Functional Style
- Performance Concerns
- Adopting the Functional Style
- Appendix A1: Starter Set of Functional Interfaces
- Appendix A2: Syntax Overview
- Appendix A3: Web Resources
- Bibliography
مشخصات
نام کتاب
Functional Programming in Java, Second Edition Edition: 2
نویسنده
Venkat Subramaniam
انتشارات
The Pragmatic Bookshelf, LLCs
تاریخ انتشار
2023
ISBN
9781680509793
تعداد صفحات
378
زبان
انگلیسی
فرمت
حجم
2.02MB
موضوع
Computers > Programming: Programming Languages > Java