Mastering JavaScript functional programming : write clean, robust, and maintainable web and server code using functional JavaScript and TypeScript / Federico Kereki.
2023
QA76.73.J39
Formats
Format | |
---|---|
BibTeX | |
MARCXML | |
TextMARC | |
MARC | |
DublinCore | |
EndNote | |
NLM | |
RefWorks | |
RIS |
Linked e-resources
Details
Title
Mastering JavaScript functional programming : write clean, robust, and maintainable web and server code using functional JavaScript and TypeScript / Federico Kereki.
Edition
Third edition.
ISBN
9781804610411 (electronic bk.)
1804610410
9781804610138
1804610410
9781804610138
Published
Birmingham, UK : Packt Publishing Ltd., 2023.
Language
English
Description
1 online resource (614 pages) : illustrations
Call Number
QA76.73.J39
System Control No.
(OCoLC)1379200826
Summary
Functional programming is a programming paradigm that uses functions for developing software. This book is filled with examples that enable you to leverage the latest JavaScript and TypeScript versions to produce modern and clean code, as well as teach you to how apply functional programming techniques to develop more efficient algorithms, write more concise code, and simplify unit testing. This book provides comprehensive coverage of the major topics in functional programming to produce shorter, clearer, and testable programs. You'll begin by getting to grips with writing and testing pure functions, reducing side effects, as well as other key features to make your applications functional in nature. The book specifically explores techniques to simplify coding, apply recursion, perform high-level coding, learn ways to achieve immutability, implement design patterns, and work with data types. By the end of this book, you'll have developed the practical programming skills needed to confidently enhance your applications by adding functional programming to wherever it's most suitable. If you are a JavaScript or TypeScript developer looking to enhance your programming skills, then this book is for you. The book applies to both frontend developers working with frameworks such as React, Vue, or Angular as well as backend developers using Node.js or Deno.
Bibliography, etc. Note
Includes bibliographical references and index.
Formatted Contents Note
Cover
Title Page
Copyright and Credits
Contributors
About the reviewers
Table of Contents
Preface
Chapter 1: Becoming Functional
Several Questions
What is functional programming?
Theory versus practice
A different way of thinking
FP and other programming paradigms
What FP is not
Why use FP?
What we need
What we get
Not all is gold
Is JavaScript functional?
JavaScript as a tool
Going functional with JavaScript
Key features of JavaScript
How do we work with JavaScript?
Using transpilers
Working online
A step further
TypeScript
Testing
Summary
Questions
Chapter 2: Thinking Functionally
A First Example
Our problem
doing something only once
Solution 1
hoping for the best!
Solution 2
using a global flag
Solution 3
removing the handler
Solution 4
changing the handler
Solution 5
disabling the button
Solution 6
redefining the handler
Solution 7
using a local flag
A functional solution to our problem
A higher-order solution
Testing the solution manually
Testing the solution automatically
Producing an even better solution
Summary
Questions
Chapter 3: Starting Out with Functions
A Core Concept
All about functions
Of lambdas and functions
Arrow functions
the modern way
Functions as objects
Using functions in FP ways
Injection
sorting it out
Callbacks and promises
Continuation-passing style
Polyfills
Stubbing
Immediate invocation (IIFE)
Summary
Questions
Chapter 4: Behaving Properly
Pure Functions
Pure functions
Referential transparency
Side effects
Advantages of pure functions
Impure functions
Avoiding impure functions
Is your function pure?
Testing
pure versus impure
Testing pure functions
Testing purified functions
Testing impure functions
Summary
Questions
Chapter 5: Programming Declaratively
A Better Style
Transformations
Reducing an array to a value
Applying an operation
map()
Dealing with arrays of arrays
More general looping
Logical HOFs
Filtering an array
Searching an array
Higher-level predicates
every() and some()
Checking negatives
none()
Working with async functions
Some strange behaviors
Async-ready looping
Working with parallel functions
Unresponsive pages
A frontend worker
A backend worker
Workers, FP style
Long-living pooled workers
Summary
Questions
Chapter 6: Producing Functions
Higher-Order Functions
Wrapping functions
keeping behavior
Logging
Timing functions
Memoizing functions
Altering a function's behavior
Doing things once, revisited
Logically negating a function
Inverting the results
Arity changing
Throttling and debouncing
Changing functions in other ways
Turning operations into functions
Turning functions into promises
Title Page
Copyright and Credits
Contributors
About the reviewers
Table of Contents
Preface
Chapter 1: Becoming Functional
Several Questions
What is functional programming?
Theory versus practice
A different way of thinking
FP and other programming paradigms
What FP is not
Why use FP?
What we need
What we get
Not all is gold
Is JavaScript functional?
JavaScript as a tool
Going functional with JavaScript
Key features of JavaScript
How do we work with JavaScript?
Using transpilers
Working online
A step further
TypeScript
Testing
Summary
Questions
Chapter 2: Thinking Functionally
A First Example
Our problem
doing something only once
Solution 1
hoping for the best!
Solution 2
using a global flag
Solution 3
removing the handler
Solution 4
changing the handler
Solution 5
disabling the button
Solution 6
redefining the handler
Solution 7
using a local flag
A functional solution to our problem
A higher-order solution
Testing the solution manually
Testing the solution automatically
Producing an even better solution
Summary
Questions
Chapter 3: Starting Out with Functions
A Core Concept
All about functions
Of lambdas and functions
Arrow functions
the modern way
Functions as objects
Using functions in FP ways
Injection
sorting it out
Callbacks and promises
Continuation-passing style
Polyfills
Stubbing
Immediate invocation (IIFE)
Summary
Questions
Chapter 4: Behaving Properly
Pure Functions
Pure functions
Referential transparency
Side effects
Advantages of pure functions
Impure functions
Avoiding impure functions
Is your function pure?
Testing
pure versus impure
Testing pure functions
Testing purified functions
Testing impure functions
Summary
Questions
Chapter 5: Programming Declaratively
A Better Style
Transformations
Reducing an array to a value
Applying an operation
map()
Dealing with arrays of arrays
More general looping
Logical HOFs
Filtering an array
Searching an array
Higher-level predicates
every() and some()
Checking negatives
none()
Working with async functions
Some strange behaviors
Async-ready looping
Working with parallel functions
Unresponsive pages
A frontend worker
A backend worker
Workers, FP style
Long-living pooled workers
Summary
Questions
Chapter 6: Producing Functions
Higher-Order Functions
Wrapping functions
keeping behavior
Logging
Timing functions
Memoizing functions
Altering a function's behavior
Doing things once, revisited
Logically negating a function
Inverting the results
Arity changing
Throttling and debouncing
Changing functions in other ways
Turning operations into functions
Turning functions into promises
Available in Other Form
Print version: Kereki, Federico. Mastering JavaScript Functional Programming. 3rd ed. Birmingham : Packt Publishing, Limited, 2023
Linked Resources
Record Appears in