Autor: Michał Płachta
Broj strana: 475
ISBN broj: 9781617291838
Izdavač: MANNING PUBLICATIONS
Godina izdanja: 2020.
Pregleda (30 dana / ukupno): 38 / 678
An absolutely wonderful book for someone that has tried and failed to understand functional programming. William E. Wheeler Grokking Functional Programming is a practical book written especially for object-oriented programmers. It will help you map familiar ideas like objects and composition to FP concepts such as programming with immutable data and higher-order functions. You will learn how to write concurrent programs, how to handle errors and how to design your solutions with modularity and readability in mind. And you'll be pleased to know that we skip the academic baggage of lambda calculus, category theory, and the mathematical foundations of FP in favor of applying functional programming to everyday programming tasks. At the end of the book, you'll be ready to pick a functional language and start writing useful and maintainable software.
Part 1: The Functional Toolkit
1.1 Perhaps you picked up this book because…
1.2 What do you need to know before we start?
1.3 How do functions look like?
1.4 Meet the function
1.5 When the code lies…
1.6 Imperative vs declarative
1.7 Coffee Break: imperative vs declarative
1.8 Coffee Break Explained: imperative vs declarative
1.9 How useful is learning functional programming?
1.10 Leaping into Scala
1.11 Practicing functions in Scala
1.12 Getting our tools ready
1.13 Getting to know the Scala REPL
1.14 Writing your first functions!
1.15 How to use this book?
2.1 Why do we need pure functions?
2.2 Coding imperatively
2.3 Passing copies of the data
2.4 Breaking the code… again
2.5 Recalculating instead of storing
2.6 Focusing on logic by passing the state
2.7 Where did all the state go?
2.8 Difference between impure & pure functions
2.9 Coffee Break: refactoring to a pure function
2.10 Coffee Break explained: refactoring to a pure function
2.11 In pure functions we trust
2.12 Difficulty of staying pure…
2.13 Pure functions and clean code
2.14 Coffee Break: pure or impure?
2.15 Coffee Break Explained: pure or impure?
2.16 Using Scala to write pure functions
2.17 Practicing pure functions in Scala
2.18 Testing pure functions
2.19 Coffee Break: testing pure functions
2.20 Coffee Break Explained: testing pure functions
3.1 The fuel for the engine
3.2 Another case for immutability
3.3 Can you trust this function?
3.4 Mutability is dangerous
3.5 Functions that lie… again
3.6 Fighting mutability by working with copies
3.7 Coffee Break: getting burnt by mutability
3.8 Coffee Break Explained: getting burnt by mutability
3.9 Introducing shared mutable state
3.10 State’s impact on programming abilities
3.11 Dealing with the moving parts
3.12 Dealing with the moving parts using FP
3.13 Immutable values in Scala
3.14 Building our intuitions about immutability
3.15 Coffee Break: The Immutable String API
3.16 Coffee Break Explained: The Immutable String API
3.17 Hold on… isn’t this bad?
3.18 Purely functional approach to the shared mutable state
3.19 Practicing immutable slicing and appending
3.20 Practicing immutable slicing and appending
4.1 Implementing requirements as functions
4.2 Impure functions and mutable values strike again
4.3 Using Java Streams to sort the list
4.4 Function signatures should tell the whole story
4.5 Changing the requirements
4.6 We just pass the code around!
4.7 Using Java’s Function values
4.8 Using Function syntax to deal with code duplication
4.9 Passing user-defined functions as arguments
4.10 Coffee Break: Functions as Parameters
4.11 Coffee Break Explained: Functions as Parameters
4.12 Problems with reading functional Java
4.13 Passing functions in Scala
4.14 Deep dive into sortBy
4.15 Solving the word ranking problem using Scala
4.16 Implementing a word ranker in Scala
4.17 Practicing function passing
4.18 Implementing a word ranker in a declarative way
4.19 Passing functions to custom-made functions
4.20 Small functions and their responsibilities
4.21 Passing functions inline
4.22 Coffee Break: Passing functions in Scala
4.23 Coffee Break Explained: Passing functions in Scala
4.24 What else can we achieve just by passing functions?
4.25 Applying a function to each element of a list
4.26 Applying a function to each element of a list using map
4.27 Getting to know map
4.28 Learn once, use everywhere
4.29 Returning parts of the list based on a condition
4.30 Returning parts of the list using filter
4.31 Getting to know filter
4.32 Practicing filter
4.33 Our journey so far…
4.34 Don’t repeat yourself?
4.35 Is my API easy to use?
4.36 Adding a new parameter is not enough
4.37 Functions can return functions
4.38 Using functions that can return functions
4.39 Coffee Break: Returning functions
4.40 Coffee Break Explained: Returning functions
4.41 Designing functional APIs
4.42 Iterative design of functional APIs
4.43 Returning functions from returned functions
4.44 How to return functions from returned functions?
4.45 Using the flexible API built with returned functions
4.46 Using multiple parameter lists in functions
4.47 Solution: Multiple parameter lists
4.48 We have been currying!
4.49 Practicing currying
4.50 Programming by passing function values
4.51 Reducing many values into one value
4.52 Reducing many values into one value using foldLeft
4.53 Getting to know foldLeft
4.54 foldLeft varia
4.55 Practicing foldLeft
4.56 Modeling immutable data
4.57 Using case classes with higher-order functions
4.58 More concise syntax for inline functions
Part 2: The Functional Techniques
Part 3: Applied Functional Programming
Functional programming is more than just writing the same old code in Scala, Clojure, or Haskell. To grok FP—to really get it—you need to rewire your brain to see the world differently. We're here to help you flip the switch. Grokking Functional Programming teaches you first to break down problems in a new way so you can approach them from a FP mindset. Following carefully-selected examples with thorough, carefully-paced explanations, you'll immerse yourself in FP concept by concept. Along the way, exercises, checks for understanding, and even the occasional puzzler give you opportunities to think and practice what you're learning.
Designing with functions and types instead of objects Multiple learning approaches to help you grok each new concept A practical programming-first teaching style Programming with pure functions & immutable values Writing concurrent programs with a functional style Testing functional programs
The book assumes that the reader has at least one year of experience developing software using a mainstream object-oriented programming language like Java. While examples use Scala, this is not a Scala book. The concepts will apply to any FP language, and no prior knowledge of Scala or FP is required.
Michał Płachta started using Scala commercially in 2014 and has been an active contributor to the Scala and JVM communities since. He regularly speaks at conferences, runs workshops, and organizes meetups to help others become better at functional programming. You can find his blog at michalplachta.com.
© Sva prava pridržana, Kompjuter biblioteka, Beograd, Obalskih radnika 4a, Telefon: +381 11 252 0 272