ENGLISH

Becoming Functional: Steps for Transforming into a Functional Programmer

Book information

Publisher
O'Reilly Media
Year
2014
ISBN
1449368174, 9781449368173
Language
english
Format
PDF
Filesize
7 MB (7317903 bytes)
Pages
134\151
Time added
2021-07-15 23:56:43

Description

If you have an imperative (and probably object-oriented) programming background, Becoming Functional will help you through the sometimes alien world of functional programming. Many functional programming books begin by focusing on the more difficult concepts such as recursion and immutability. This book lets you dive right in to functional programming by teaching the most useful implementation concepts first. Once you finish a chapter, you’ll be able to take the concept you just learned and use it in their current day-to-day job. Each chapter introduces a problem and investigates ways to solve it by going from imperative pseudo-code to functional pseudo-code. Copyright Table of Contents Preface Who Is This Book For? Math Notation Review Why Functional over Imperative? Why Functional Alongside OOP? Why Functional Programming Is Important Conventions Used in This Book Using Code Examples Safari® Books Online How to Contact Us Acknowledgments Chapter 1. Introduction Overview of Concepts in Functional Programming First-Class Functions Pure Functions Recursion Immutable Variables Nonstrict Evaluation Statements Pattern Matching Functional Programming and Concurrency Conclusion Chapter 2. First-Class Functions Introduction to XXY Functions as Objects Refactoring Using If-Else Structures Refactoring Using Function Objects to Extract Fields Anonymous Functions Lambda Functions Closures Higher-Order Functions Refactoring get Functions by Using Groovy Conclusion Chapter 3. Pure Functions Output Depends on Input Purifying Our Functions Side Effects Conclusion Making the Switch to Groovy Chapter 4. Immutable Variables Mutability Immutability Conclusion Chapter 5. Recursion An Introduction to Recursion Recursion Tail Recursion Refactoring Our countEnabledCustomersWithNoEnabledContacts Function Conclusion Introducing Scala Chapter 6. Strict and Nonstrict Evaluations Strict Evaluation Nonstrict (Lazy) Evaluation Laziness Can Create Problems Conclusion Chapter 7. Statements Taking the Plunge Simple Statements Block Statements Everything Is a Statement Conclusion Chapter 8. Pattern Matching Simple Matches Simple Patterns Extracting Lists Extracting Objects Converting to Pattern Matches Conclusion Chapter 9. Functional OOP Static Encapsulation Objects As Containers Code as Data Conclusion Chapter 10. Conclusion From Imperative to Functional Introduce Higher-Order Functions Convert Existing Methods into Pure Functions Convert Loops to Tail/Recursive-Tail Methods Convert Mutable Variables into Immutable Variables What Next? New Design Patterns Message Passing for Concurrency The Option Pattern (Extension of Null Object Pattern) Object to Singleton Method Purity Putting It All Together Conclusion Index About the Author

Similar books