Jump to ratings and reviews
Rate this book

A skeptic's guide to functional programming with JavaScript: How to level up your code without alienating your team

Rate this book
What if the team hates my functional code? Learning functional programming can be intoxicating. Your code becomes more elegant, more expressive—solid. But what if the people you work with don’t get it? Some of their concerns are legitimate. Others are plain ignorant. But how do you tell the difference? And either way, how do you have a rational conversation when there’s so much angst? It seems like an impossible situation. But it doesn’t have to be. What if you knew what to expect, ahead of time? Imagine if you already had intelligent, thoughtful responses, ready to go. Better yet, what if you could bring the team on the journey with you; help them see the beauty and benefits of functional code? This book will guide you through sorting myths from reality. Learn to spot performance pitfalls. Adjust your code to suit the team’s familiarity, without compromising confidence. Learn to have nuanced, reasonable discussions. Write expressive, elegant code… and ship it!

288 pages, Paperback

Published November 24, 2022

2 people are currently reading
23 people want to read

About the author

James Sinclair

311 books2 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
3 (42%)
4 stars
3 (42%)
3 stars
1 (14%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 4 of 4 reviews
Profile Image for Tom.
10 reviews
January 9, 2023
Fantastic book to get a little deeper into functional programming.
Profile Image for Abbas Abdulmalik.
1 review
February 2, 2023
Regarding A Skeptic’s Guide to Functional Programming, I was fairly delighted early on with the pipe function on page 15, which did something I had never seen or considered, namely using the reduce method to iterate over a list of functions rather than over an array of data, where each function takes its turn producing a new modified array of data based on a given initial array; very clever. I said to myself, if this marks the level of sophistication to be seen in these pages, I can handle that and can move along at a fairly steady pace.

Then, it was on page 19, after looking at the “Just” function that I said to myself “uh-oh, this is where it starts.” It was there that I had to slow down, and where it was confirmed to me that along the road to learning functional programming, I have to run the gauntlet of the strange and unusual. It kind of reminded me of the time a few decades ago when I picked up a book entitled Gödel, Escher, Bach: an Eternal Golden Braid by Douglas Hofstadter. That book was a fascinating read until it went over my head. I put that book on the shelf, and it has remained there ever since.

This book is definitely not a “hand-holdy” trivial JavaScript tutorial on functional programming. But, to be fair, it is nowhere near as dense or hybridized as the aforementioned work of literature and logic, but the first stumbling block at least echoes the theme of that other book, namely self-referential entities. The “Just” function is not strictly recursive, but it returns an object that defines a function that invokes the object’s progenitor, namely the Just function. I had to think about that for a little while.

You have to have been around the block a few times with the JavaScript language to have any hope of moving quickly through this book. The author, James Sinclair, does warn us fairly early in introducing algebraic structures on page 11 that “…there’s no point in solving toy problems. We can do better than adding two numbers together.” So you'd better be prepared to see higher-order functions, arrow functions that return arrow functions, partial application of functions, and other practices that are now fairly standard since the release of JavaScript version ES6.

Now, I consider myself to be a fairly smart fellow, but I wouldn’t want to compete with the typical Harvard or Stanford guy in untying the Gordian knot. I’d rather just slash it like Alexander. But it is clear that this topic will have to be carefully un-tied the hard way. It will be a challenge to remain fascinated with it because it can be wearying. But unlike the Hofstadter book, which was just an interesting read for me, this book not only elucidates something interesting, it promises to lead to something useful. It will not join Hofstadter’s book on the shelf.

Those who have followed James Sinclair’s blog posts through the years know that he gives you solid JavaScript knowledge in a well-written literary style, and this book continues along those lines. Nevertheless, the author knows the topic is rather difficult, so he has dedicated more than 40% of the pages to an appendix that consists of five chapters in their own right that explain Maybe monads, higher-order functions in depth, how to deal with side effects, and more.

In September 2017 the Atlantic magazine featured a long article entitled The Coming Software Apocalypse that illustrated some dangerous failures of poorly written software, like Toyotas accelerating when braking or a region’s 911 system breaking down for hours. So the recent Southwest Airlines scheduling fiasco, or something like it, was very predictable. Software developers are put on notice to transition their programming practices to produce bullet-proof code that does only what is expected of it. Unless there are alternatives, I suppose such code should attempt to be strictly functional, and I assume the author would agree. Unfortunately, my engagement with this topic using this book will have to remain only in the form of a hobby until I reach a level of competence to put functional programming to practical use.

Though learning functional programming in the context of JavaScript opens up this topic to one of the widest coding audiences, if you are rather new to JavaScript, this topic can potentially break your spirit. So I would advise newcomers to steer clear until they’ve had a least a year or more of JavaScript experience. But if you are a veteran JS coder, this book can raise your hopes and can help raise your craft to a powerful and elegant level, which may well prevent you from causing the next software apocalypse. I think it will be well worth the effort.
Profile Image for Abbe.
1 review
January 29, 2023
Very informative book. Applicatives and the Effect functor/monad (IO in fp-ts and Haskell) finally clicked for me!
Profile Image for Austin.
125 reviews2 followers
September 4, 2023
The title is a bit misleading: the intended audience is not so much the functional programming skeptic but the programmer trying to convince skeptical colleagues of the benefits of functional programming. Sinclair does a good job explaining both how one can go about adopting functional programming in JavaScript and why one would want to do so, with clear and practical examples.

Although Sinclair doesn't make an argument for this explicitly—in fact some comments of his suggest that he might think the idea is impractical—one conclusion I drew from reading this was how valuable it is to be able to use a purely functional language (like Elm) that compiles to JavaScript, instead of just having to write JavaScript functionally.
Displaying 1 - 4 of 4 reviews

Can't find what you're looking for?

Get help and learn more about the design.