The Joy of JavaScript

Book description

Whether building interactive browser-based applications or creating server-side applications in Node, JavaScript is the most widely used language for web programming. With new features, language improvements, paradigms, and potential use cases appearing regularly, there’s never been a more exciting time to be a JavaScript developer. In The Joy of JavaScript, author and JavaScript expert Luis Atencio teaches you key design concepts that lead to clean, lean, modular, and easy-to-maintain code.

About the Technology
JavaScript is at the heart of web applications on the browser side and, via the popular Node.js runtime, it often powers the server side too. Simply put, the web runs on JavaScript.

About the Book
The Joy of JavaScript introduces techniques that turn JavaScript programmers into JavaScript pros. You’ll work with cutting edge APIs, language features, and coding styles to tackle tricky problems in an elegant manner. Along the way, you’ll practice good object design, drive business logic with functional thinking, and untangle complex data flows.

What's Inside
  • JavaScript’s objects and module system
  • Working with higher order functions
  • Identifying and creating composable software
  • Preparing for upcoming JavaScript features


About the Reader
Written for experienced and passionate JavaScript developers.

About the Author
Luis Atencio is a software engineer for Citrix Systems, author of Manning’s Functional Programming in JavaScript, and co-author of Manning’s RxJS in Action.

Quotes
Goes beyond purely functional programming concepts and covers every topic a developer needs to know while reading or writing JavaScript.
- Gleb Bahmutov, Cypress.io

The actual joy here was reading it! The definitive guide to becoming a JavaScript professional.
- Ubaldo Pescatore, Generali Business Solutions

Teaches modern JavaScript features and techniques with concise descriptions and code samples that feel like they came from a real application.
- Nate Clark, Base Camp Coding Academy

A must-read for every JavaScript developer wanting to upskill.
- Lora Vardarova, CoGo

Table of contents

  1. inside front cover
  2. The Joy of JavaScript
  3. Copyright
  4. dedication
  5. brief contents
  6. contents
  7. front matter
    1. preface
    2. acknowledgments
    3. about this book
    4. about the author
    5. about the cover illustration
  8. 1 JavaScript reloaded
    1. 1.1 Evolving JavaScript
    2. 1.2 Objects
    3. 1.3 Functions
    4. 1.4 Code
    5. 1.5 Data
    6. 1.6 Sample application: Blockchain
    7. Summary
  9. Part 1. Objects
  10. 2 Inheritance-based object modeling
    1. 2.1 Reviewing prototypal inheritance
      1. 2.1.1 Property resolution process
      2. 2.1.2 Differential inheritance
    2. 2.2 Constructor functions
      1. 2.2.1 Functions as templates
      2. 2.2.2 Sharing properties by using constructors and prototypes
    3. 2.3 Class-based inheritance
    4. Summary
  11. 3 Linked, compositional object models
    1. 3.1 Types of object links
      1. 3.1.1 Implicit
      2. 3.1.2 Explicit
    2. 3.2 OLOO
    3. 3.3 Understanding Object.assign
      1. 3.3.1 Object.assign uncovered
      2. 3.3.2 Assignment vs definition
    4. 3.4 Assembling objects using mixin composition
      1. 3.4.1 Anatomy of a mixin
      2. 3.4.2 Multiple inheritance and linearization
      3. 3.4.3 Composing objects using Object.assign and the spread operator
    5. 3.5 Applying shared mixins to multiple objects
    6. Summary
  12. Part 2. Functions
  13. 4 Writing composable, pure code
    1. 4.1 What is functional programming?
      1. 4.1.1 Functions as data
      2. 4.1.2 The functional way
    2. 4.2 Functional versus imperative at a glance
    3. 4.3 Composition: The functional way
      1. 4.3.1 Working with side effects
      2. 4.3.2 Decomposing complex code
    4. 4.4 Currying and closures
      1. 4.4.1 Curried function application
      2. 4.4.2 The curry and composition dynamic duo
    5. 4.5 Working with immutable objects
    6. 4.6 Point-free coding
    7. 4.7 Imperative to functional transformation
    8. 4.8 Native function chains
    9. Summary
  14. 5 Higher-kinded composition
    1. 5.1 Closing over data types
    2. 5.2 New Array APIs: {flat, flatMap}
      1. 5.2.1 Array.prototype.flat
      2. 5.2.2 Array.prototype.flatMap
    3. 5.3 The map/compose correspondence
    4. 5.4 Universal contracts
      1. 5.4.1 Functors
      2. 5.4.2 Monads
    5. 5.5 Contextual validation with higher-order functions
      1. 5.5.1 Kinds of ADTs
      2. 5.5.2 Choices
      3. 5.5.3 Modeling success and failure with the Validation monad
      4. 5.5.4 Composing with monads
      5. 5.5.5 Higher-kinded composition with Validation
      6. 5.5.6 Point-free coding with monads
      7. 5.5.7 Reducing complex data structures
      8. 5.5.8 Third-party integration
    6. 5.6 Higher-kinded composition with method extraction and dynamic binding
    7. Summary
  15. Part 3. Code
  16. 6 ECMAScript Modules
    1. 6.1 Past state of affairs
    2. 6.2 Module patterns
      1. 6.2.1 Object namespaces
      2. 6.2.2 Immediately Invoked Function Expressions (IIFEs)
      3. 6.2.3 IIFE mixins
      4. 6.2.4 Factory functions
    3. 6.3 Static vs. dynamic module systems
    4. 6.4 ESM basics
      1. 6.4.1 Path specifiers
      2. 6.4.2 Exporting
      3. 6.4.3 Importing
      4. 6.4.4 A new extension in town
    5. 6.5 Benefits of ESM for tooling
      1. 6.5.1 Dead-code elimination and tree-shaking
      2. 6.5.2 Faster property lookups
      3. 6.5.3 Type-friendliness
    6. Summary
  17. 7 Hooked on metaprogramming
    1. 7.1 Common uses of metaprogramming in JavaScript
    2. 7.2 JavaScript symbols
    3. 7.3 Symbol registries
      1. 7.3.1 Local registry
      2. 7.3.2 Global registry
    4. 7.4 Practical application of symbols
      1. 7.4.1 Hidden properties
      2. 7.4.2 Interoperability
      3. 7.4.3 Serialization
    5. 7.5 Well-known symbols
      1. 7.5.1 @@toStringTag
      2. 7.5.2 @@isConcatSpreadable
      3. 7.5.3 @@species
      4. 7.5.4 @@toPrimitive
      5. 7.5.5 @@iterator
    6. 7.6 Dynamic introspection and weaving
      1. 7.6.1 Proxy objects
      2. 7.6.2 The Reflect API
      3. 7.6.3 Additional use cases
    7. 7.7 Implementing method decorators
    8. Summary
  18. Part 4. Data
  19. 8 Linear async flows
    1. 8.1 Architecture at a glance
    2. 8.2 JavaScript as promised
      1. 8.2.1 Principle of data locality
      2. 8.2.2 Are promises algebraic?
      3. 8.2.3 Fluent chaining
      4. 8.2.4 Promises in the wild
    3. 8.3 API review: Promise combinators
      1. 8.3.1 Promise.all
      2. 8.3.2 Promise.race
      3. 8.3.3 Promise.allSettled
      4. 8.3.4 Promise.any
    4. 8.4 async made easy
    5. 8.5 async iteration
    6. 8.6 Top-level await
    7. Summary
  20. 9 Streams programming
    1. 9.1 Iterables and Iterators
      1. 9.1.1 Iterable protocol
      2. 9.1.2 Iterator protocol
      3. 9.1.3 Examples
    2. 9.2 Generators
      1. 9.2.1 To return or to yield
      2. 9.2.2 Creating iterable objects
      3. 9.2.3 Async generators
    3. 9.3 Working with data streams
      1. 9.3.1 What is a stream?
      2. 9.3.2 Implementing a streamable array
    4. 9.4 Welcoming a new native: Observable
      1. 9.4.1 What is an Observable?
      2. 9.4.2 Creating custom observables
      3. 9.4.3 Building your own reactive toolkit
      4. 9.4.4 Observable mixin extension
      5. 9.4.5 Representing push streams with generators
      6. 9.4.6 Pipeable operators
      7. 9.4.7 Streamifying objects
      8. 9.4.8 Dynamic streamification
    5. 9.5 Closing thoughts
    6. Summary
  21. appendix A. Configuring Babel
  22. appendix B. Typed JavaScript<T>
    1. B.1 First, what?
    2. B.2 Benefits and drawbacks of statically typed JavaScript
    3. B.3 Type annotations
      1. B.3.1 Class types
      2. B.3.2 Interface types
      3. B.3.3 Object types
      4. B.3.4 Function types
      5. B.3.5 Generic types
      6. B.3.6 Union types
  23. index
  24. PATTERNS OF COMPOSABLE SOFTWARE

Product information

  • Title: The Joy of JavaScript
  • Author(s): Luis Atencio
  • Release date: March 2021
  • Publisher(s): Manning Publications
  • ISBN: 9781617295867