万本电子书0元读

万本电子书0元读

顶部广告

JavaScript: Functional Programming for JavaScript Developers电子书

售       价:¥

8人正在读 | 0人评论 9.8

作       者:Ved Antani,Simon Timms,Dan Mantyla

出  版  社:Packt Publishing

出版时间:2016-08-01

字       数:578.3万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Unlock the powers of functional programming hidden within JavaScript to build smarter, cleaner, and more reliable web apps About This Book Write powerful code with the high-level functions that JavaScript offers Discover what functional programming is, why it's effective, and how it's used in JavaScript Understand and optimize JavaScript's hidden potential as a true functional language Who This Book Is For If you are a JavaScript developer interested in learning functional programming, looking for the quantum leap toward mastering the JavaScript language, or just want to become a better programmer in general, then this book is ideal for you. This guide is aimed at programmers, involved in developing reactive frontend apps, server-side apps that wrangle with reliability and concurrency, and everything in between. What You Will Learn Get a run through of the basic JavaScript language constructs Code using the powerful object-oriented feature in JavaScript Master DOM manipulation, cross-browser strategies, and ES6 Understand the basic concurrency constructs in Java* and best performance strategies Harness the power of patterns for tasks ranging from application building to code testing Build large-scale apps seamlessly with the help of reactive patterns Explore advanced design patterns, including dependency injection Develop more powerful applications with currying and function composition Create more reliable code with closures and immutable data In Detail JavaScript is a high-level, dynamic, untyped, lightweight, and interpreted programming language and functional programming is a style that emphasizes and enables smarter code that minimizes complexity and increases modularity. It's a way of writing cleaner code through clever ways of mutating, combining, and using functions. And JavaScript provides an excellent medium for this approach. By learning how to expose JavaScript's true identity as a functional language, we can implement web apps that are more powerful, easier to maintain and more reliable. The java *: Functional Programming for JavaScript Developers course will take you on a journey to show how functional programming when combined with other techniques makes JavaScript programming more efficient. The first module Mastering JavaScript, stress on practical aspects of Java* development like—Functions and Closures, Runtime debugging techniques, project layout, events and DOM processing, build tools, Object-oriented patterns, isomorphism—everything that a modern Java* project would need. The second module, Mastering JavaScript Design Patterns - Second Edition, will explore how design patterns can help you improve and organize your JavaScript code. You’ll get to grips with creational, structural, and behavioral patterns as you discover how to put them to work in different scenarios. This updated edition will also delve into reactive design patterns and microservices as they are a growing phenomenon in the world of web development. It will also show you some advanced patterns, including dependency injection and live post processing. The third module, Functional Programming in JavaScript, will help you to write real-world applications by utilizing a wide range of functional techniques and styles. It explores the core concepts of functional programming common to all functional languages, with examples of their use in JavaScript. Style and approach This course will begin with providing insights and practical tips on advanced JavaScript features to build highly scalable web and mobile system and move on to some design patterns with JavaScript. Finally, the course ends with presenting the functional programming techniques and styles in JavaScript.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部