December 8, 2019

307 words 2 mins read

Immutable data structures for functional JavaScript

Immutable data structures for functional JavaScript

Functional programmingprogramming without side effects or mutabilityhas great advantages, especially for JavaScript developers, but never mutating data can lead to efficiency problems. Anjana Vakil explains how immutable data structures provide an elegant solution and explores two libraries that make it easy to use these remarkable data structures in your own JavaScript projects.

Talk Title Immutable data structures for functional JavaScript
Speakers Anjana Vakil (Mapbox)
Conference O’Reilly Fluent Conference
Conf Tag The Web Platform in Practice
Location San Jose, California
Date June 20-22, 2017
URL Talk Page
Slides Talk Slides
Video

Functional programming has been gaining popularity in the JavaScript community, and for good reason: rejecting side-effects and mutability (in-place changes to data) helps avoid a lot of headaches. But even if you refuse to mutate objects, you’ll still need to deal with transformations to data. In a purely immutable world, this means you have to create a whole new object each time something changes, which can slow things down and eat up memory, making functional programming seem inefficient. That’s where immutable data structures come in to save the day—and time and space. Also called persistent data structures, they help you efficiently make new “modified” versions of immutable objects by reusing parts of the old object that you don’t need to change. By making immutability efficient, such data structures are fantastic for functional programming and play a central role in functional languages such as Clojure. Anjana Vakil explains how the concept of structural sharing makes efficient immutable data structures possible and demonstrates how they work under the hood. Anjana also offers an overview of two libraries—Mori and Immutable.js—that let you easily take advantage of these remarkable data structures in your JavaScript code. You’ll leave armed with a deeper understanding of how immutable data structures work and the practical knowledge to leverage them in your own functional JavaScript projects.

comments powered by Disqus