Hey Underscore, You're Doing It Wrong!

Channel:InfoQ · Length:36:30 · Published:2013-05-21 · Views:141472

Watch on YouTube

Summary

Brian Lonsdorf explains why Underscore.js falls short as a functional programming library, then introduces currying, composition and point-free style in JavaScript. He argues for data-last argument ordering.

Why HN recommends it

A repeatedly recommended introduction to functional JavaScript that explains currying and why data should come last.

this video gives a pretty good explanation in ~30 minutes — HN, 2016

Functional programming · Web development

Subtitles (excerpt)

[Music] okay um I'm going to get started because it's the last Talk of the day everybody probably wants to go get a drink I want to go get a drink is there after parties does anybody know all right cool thank somebody grab me and take me to one um so you can yell at me for this talk so um this talk I originally wanted the talk about um lenses and traversible um yeah but it turned out that um you know I've given a couple similar talks and if you've seen um uh me talk at HTML 5 Dev comp before I've spoken about Point free and um type classes and this is kind of a mixture of all that I don't think I could have uh written a talk about anything else because it's people are still trying to get their heads wrapped around this and and I guess I am too and I don't want to go too far without hitting the basics so um pretty much going to talk about uh Point free programming and type classes all in the context of underscore um so yeah and I'm going to bash underscore like crazy you guys not really not so okay so I I do love underscore I think it's great um so I'm not I'm not here to make fun of it or say it's terrible or be like low Dash rules and you know it doesn't work on node and things like that um so uh I am here to talk

On Hacker News

I find this talk inspiring. Underscore.js got many things wrong for FP: [VIDEO] . I've read Grokking Simplicity too. It's very approachable book. Highly recommend it for JS/TS developers who want to learn FP! — r3a1d33p, 2022-08
There is an excellent talk called "Underscore, you're doing it wrong!". The talk explains how well designed param order with currying leads to very short and expressive code -- and how underscore missed the boat. This aspect of it should be interesting as it's related to this post. It's well worth the watch. [VIDEO] — wizao, 2015-01
That is great feedback. I am actually working on creating a "functional" version of the 2048 game, along with my own implementation of the AI solver, as part of this series. Kinda goofy, and maybe not a "real world" situation as much, but should at least show the concepts being applied. I also very much recommend this video by Brian Lonsdorf, titled "Hey Underscore, You're Doing It Wrong!: [VIDEO] — lrichardson, 2014-04
With all due respect, I don't think you understand the purpose of currying and partial application. In your defense, the article merely explains what currying is, but does not explain why you need it. For instance while writing functional Javascript code, I never curry my methods, instead I use helper methods from functional libraries such as lodash or Ramda to curry. Where currying is useful is … — splintercell, 2017-09
Because then you can curry/partially apply functions independent of your data. It's _not_ because it's convention everywhere else. (I realize that only really makes sense if you know why it makes sense, so this video gives a pretty good explanation in ~30 minutes - [VIDEO] ) — patricklynch, 2016-07

Related videos