Have a personal or library account? Click to login
Composing Software Cover

Composing Software

An Exploration of Functional Programming and Object Composition in JavaScript

Paid access
|Oct 2024

Unlock the power of functional programming in JavaScript with this detailed guide. Master essential techniques like function composition, immutability, and higher-order functions to create modular, maintainable code that's easy to understand and reuse.

Key Features

  • An exploration of functional programming in JavaScript, from basics to advanced concepts
  • An extensive focus on real-world applications & problem-solving techniques
  • An introduction to both functional and object-oriented programming for a holistic view

Book Description

This book delves into functional programming and composition techniques in JavaScript, starting with core concepts like pure functions, shared state avoidance, and higher-order functions to build modular, maintainable code. Early chapters explore the fundamentals of functional programming, immutability, and its growing influence in the JavaScript community. You'll learn essential topics such as function composition, currying, and higher-order functions, as well as advanced concepts like abstract data types, functors, and monads. The book discusses the evolution of functional programming, its role in modern software development, and addresses challenges like the software crisis and composing with classes.

You'll learn essential topics like object-oriented programming, focusing on factory functions, functional mixins, and object composition. You'll also understand why traditional classes complicate composition and discover strategies for creating custom data types, lenses, and transducers. The book also covers best practices, emphasizing clean, reusable code and avoiding anti-patterns like excessive mocking.

By the end, you'll be ready to apply functional programming techniques to tackle complex design challenges and write more maintainable JavaScript code.

What you will learn

  • Grasp core principles for writing clean, efficient code
  • Combine functions to create complex operations with ease
  • Write functions that are predictable and easy to test
  • Eliminate shared state and side effects for more reliable code
  • Use functions as arguments or return values for flexibility
  • Learn data transformations and side effect management

Who this book is for

The book is ideal for JavaScript developers who want to deepen their understanding of functional programming and software composition. Familiarity with JavaScript basics is required. This book is suitable for both intermediate and advanced programmers who want to write more maintainable and modular code.

Table of Contents

  1. Composing Software: An Introduction
  2. The Dao of Immutability (The Way of the Functional Programmer)
  3. The Rise and Fall and Rise of Functional Programming (Composable Software)
  4. Why Learn Functional Programming in JavaScript?
  5. Pure Functions
  6. What is Functional Programming?
  7. A Functional Programmer's Introduction to JavaScript
  8. Higher Order Functions
  9. Curry and Function Composition
  10. Abstraction & Composition
  11. Abstract Data Types and the Software Crisis
  12. Functors & Categories
  13. Monads
  14. The Forgotten History of OOP
  15. Object Composition
  16. Factory Functions
  17. Functional Mixins
  18. Why Composition is Harder with Classes
  19. Composable Custom Data Types
  20. Lenses
  21. Transducers
  22. Elements of JavaScript Style
  23. Mocking is a Code Smell
PDF ISBN: 978-1-83664-462-0
Publisher: Packt Publishing Limited
Copyright owner: © 2024 Packt Publishing Limited
Publication date: 2024
Language: English
Pages: 238

People also read