售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
JavaScript: Functional Programming for JavaScript Developers
Table of Contents
JavaScript: Functional Programming for JavaScript Developers
JavaScript: Functional Programming for JavaScript Developers
Credits
Preface
What this learning path covers
What you need for this learning path
Who this learning path is for
Reader feedback
Customer support
Downloading theexample code
Errata
Piracy
Questions
1. Module 1
1. JavaScript Primer
A little bit of history
How to use this book
Hello World
An overview of JavaScript
Comments
Variables
Constants
Number
String
Undefined values
Booleans
The instanceof operator
Date objects
The + operator
The ++ and -- operators
Boolean operators
Equality
Strict equality using ===
Weak equality using ==
JavaScript types
Automatic semicolon insertion
JavaScript style guide
Whitespaces
Parentheses, line breaks, and braces
Quotes
End of lines and empty lines
Type checking
Type casting
Conditional evaluation
Naming
The eval() method is evil
The strict mode
Enabling the strict mode for an existing code can break it
Package with care
Variables must be declared in strict mode
The eval() function is cleaner in strict mode
Features that are blocked in strict mode
Running JSHint
Summary
2. Functions, Closures, and Modules
A function literal
A function declaration
Functions as data
Scoping
Global scope
Local scope
Function-level scope versus block-level scope
Inline function expressions
Block scopes
Function declarations versus function expressions
The arguments parameter
The this parameter
Invocation as a function
Invocation as a method
Invocation as a constructor
Invocation using apply() and call() methods
Anonymous functions
Anonymous functions while creating an object
Anonymous functions while creating a list
Anonymous functions as a parameter to another function
Anonymous functions in conditional logic
Closures
Timers and callbacks
Private variables
Loops and closures
Modules
Stylistic considerations
Summary
3. Data Structures and Manipulation
Regular expressions
Exact match
Match from a class of characters
Repeated occurrences
Alternatives – OR
Beginning and end
Backreferences
Greedy and lazy quantifiers
Arrays
Maps
Sets
A matter of style
Summary
4. Object-Oriented JavaScript
Understanding objects
Behavior of JavaScript objects
Prototypes
Instance properties versus prototype properties
Inheritance
Getters and setters
Summary
5. Testing and Debugging
Unit testing
Test-driven development
Behavior-driven development
JavaScript debugging
Syntax errors
Using strict
Runtime exceptions
Console.log and asserts
Chrome DevTools
Summary
6. ECMAScript 6
Shims or polyfills
Transpilers
ES6 syntax changes
Block scoping
Default parameters
Spread and rest
Destructuring
Object literals
Template literals
Maps and Sets
Symbols
Iterators
For..of loops
Arrow functions
Summary
7. DOM Manipulation and Events
DOM
Accessing DOM elements
Accessing specific nodes
Chaining
Traversal and manipulation
Working with browser events
Propagation
jQuery event handling and propagation
Event delegation
The event object
Summary
8. Server-Side JavaScript
An asynchronous evented-model in a browser
Callbacks
Timers
EventEmitters
Modules
Creating modules
npm
Installing packages
JavaScript performance
JavaScript profiling
The CPU profile
The Timeline view
Summary
2. Module 2
1. Designing for Fun and Profit
The road to JavaScript
The early days
A pause
The way of GMail
JavaScript everywhere
What is a design pattern?
Anti-patterns
Summary
2. Organizing Code
Chunks of code
What's the matter with global scope anyway?
Objects in JavaScript
Build me a prototype
Inheritance
Modules
ECMAScript 2015 classes and modules
Best practices and troubleshooting
Summary
3. Creational Patterns
Abstract factory
Implementation
Builder
Implementation
Factory method
Implementation
Singleton
Implementation
Disadvantages
Prototype
Implementation
Tips and tricks
Summary
4. Structural Patterns
Adapter
Implementation
Bridge
Implementation
Composite
Example
Implementation
Decorator
Implementation
Façade
Implementation
Flyweight
Implementation
Proxy
Implementation
Hints and tips
Summary
5. Behavioral Patterns
Chain of responsibility
Implementation
Command
Command message
Invoker
Receiver
Interpreter
Example
Implementation
Iterator
Implementation
ECMAScript 2015 iterators
Mediator
Implementation
Memento
Implementation
Observer
Implementation
State
Implementation
Strategy
Implementation
Template method
Implementation
Visitor
Hints and tips
Summary
Part 2
6. Functional Programming
Functional functions are side-effect-free
Function passing
Implementation
Filters and pipes
Implementation
Accumulators
Implementation
Memoization
Implementation
Immutability
Lazy instantiation
Implementation
Hints and tips
Summary
7. Reactive Programming
Application state changes
Streams
Filtering streams
Merging streams
Streams for multiplexing
Hints and tips
Summary
8. Application Patterns
First, some history
Model View Controller
MVC code
Model View Presenter
MVP code
Model View ViewModel
MVVM code
A better way to transfer changes between the model and the view
Observing view changes
Tips and tricks
Summary
9. Web Patterns
Sending JavaScript
Combining files
Minification
Content Delivery Networks
Plugins
jQuery
d3
Doing two things at once – multithreading
Circuit breaker pattern
Back-off
Degraded application behavior
Promise pattern
Hints and tips
Summary
10. Messaging Patterns
What's a message anyway?
Commands
Events
Request-reply
Publish-subscribe
Fan out and in
Dead letter queues
Message replay
Pipes and filters
Versioning messages
Hints and tips
Summary
11. Microservices
Façade
Service selector
Aggregate services
Pipeline
Message upgrader
Failure patterns
Service degradation
Message storage
Message replay
Indempotence of message handling
Hints and tips
Summary
12. Patterns for Testing
The testing pyramid
Testing in the small with unit tests
Arrange-Act-Assert
Assert
Fake objects
Test spies
Stubs
Mock
Monkey patching
Interacting with the user interface
Browser testing
Faking the DOM
Wrapping the manipulation
Tips and tricks
Summary
13. Advanced Patterns
Dependency injection
Live post processing
Aspect oriented programming
Mixins
Macros
Tips and tricks
Summary
14. ECMAScript-2015/2016 Solutions Today
TypeScript
Decorators
Async/Await
Typing
BabelJS
Classes
Default parameters
Template literals
Block bindings with let
In production
Tips and tricks
Summary
3. Module 3
1. The Powers of JavaScript's Functional Side – a Demonstration
Introduction
The demonstration
The application – an e-commerce website
Imperative methods
Functional programming
Summary
2. Fundamentals of Functional Programming
Functional programming languages
What makes a language functional?
Advantages
Cleaner code
Modularity
Reusability
Reduced coupling
Mathematically correct
Functional programming in a nonfunctional world
Is JavaScript a functional programming language?
Working with functions
Self-invoking functions and closures
Higher-order functions
Pure functions
Anonymous functions
Method chains
Recursion
Divide and conquer
Lazy evaluation
The functional programmer's toolkit
Callbacks
Array.prototype.map()
Array.prototype.filter()
Array.prototype.reduce()
Honorable mentions
Array.prototype.forEach
Array.prototype.concat
Array.prototype.reverse
Array.prototype.sort
Array.prototype.every and Array.prototype.some
Summary
3. Setting Up the Functional Programming Environment
Introduction
Functional libraries for JavaScript
Underscore.js
Fantasy Land
Bilby.js
Lazy.js
Bacon.js
Honorable mentions
Development and production environments
Browsers
Server-side JavaScript
A functional use case in the server-side environment
CLI
Using functional libraries with other JavaScript modules
Functional languages that compile into JavaScript
Summary
4. Implementing Functional Programming Techniques in JavaScript
Partial function application and currying
Function manipulation
Apply, call, and the this keyword
Binding arguments
Function factories
Partial application
Partial application from the left
Partial application from the right
Currying
Function composition
Compose
Sequence – compose in reverse
Compositions versus chains
Programming with compose
Mostly functional programming
Handling events
Functional reactive programming
Reactivity
Putting it all together
Summary
5. Category Theory
Category theory
Category theory in a nutshell
Type safety
Object identities
Functors
Creating functors
Arrays and functors
Function compositions, revisited
Monads
Maybes
Promises
Lenses
jQuery is a monad
Implementing categories
Summary
6. Advanced Topics and Pitfalls in JavaScript
Recursion
Tail recursion
The Tail-call elimination
Trampolining
The Y-combinator
Memoization
Variable scope
Scope resolutions
Global scope
Local scope
Object properties
Closures
Gotchas
Function declarations versus function expressions versus the function constructor
Function declarations
Function expressions
The function constructor
Unpredictable behavior
Summary
7. Functional and Object-oriented Programming in JavaScript
JavaScript – the multi-paradigm language
JavaScript's object-oriented implementation – using prototypes
Inheritance
JavaScript's prototype chain
Inheritance in JavaScript and the Object.create() method
Mixing functional and object-oriented programming in JavaScript
Functional inheritance
Strategy Pattern
Mixins
Classical mixins
Functional mixins
Summary
A. Common Functions for Functional Programming in JavaScript
B. Glossary of Terms
A. Bibliography
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜