DEV Community

loading...

Learning functional programming in javascript: A roadmap

vonheikemen profile image Heiker Originally published at vonheikemen.github.io Updated on ・4 min read

Puedes leer la versión en español aquí.

Learning about functional programming is not an easy task, specially if you search for articles that have concrete examples of the concepts they try to teach. I have been learning about this paradigm for a while and I want it to share the notes I have taken, the ones I've turn into articles, and also the source material where I got the information.

Even though all these articles are related I didn't plan on writing them. So, I'll be presenting some sort of guide (a suggestion) on the order they should be read.

Some of these articles are available in the form of an observablehq notebook, where you can play around with the source code of every snippet. If there is an asterisk it will take you there. You can also find them here.

The basics

To begin I would like you to see the video of the talk that convinced me to try learning this paradigm. The talk is about what is and what isn't functional programming, it also shows some examples of the core principles using javascript.

To complement that video I wrote my own notes.

Further reading

A very special tool

If you read everything so far you already have enough knowledge to add some functional style to your everyday coding. You don't have to know every trick in the book to start seeing the benefits of this paradigm.

So, I want you to pay close attention to something called partial application, just like the concept of a pure function, partial application can help you a lot even if you decide you don't want to write code in a functional style.

This are my notes on the topic (with practical examples):

If you are convinced that this is useful then watch this video, in here you can see the kind of thing you can accomplish.

How to put the pieces together

Now, knowing the basics is one thing, it's a whole other deal knowing how to use them in the most effective way. You already have the tools but you might be wondering how all of this fits together, that is our next step.

In this article we are going to learn how to use everything we have learned.

Just in case you missed it. In this talk (the source of the previous article) you can see in more detail what composition is about.

One step further

By now you must know how to manipulate functions and make them do your bidding. But I bet there are still things you want to know in more detail, two in particular: Functors and Monads. So, I'll try my best to tell you how you can use them to your advantage.

Extra content

More interesting talks

If you're still wondering what you can do just by composing functions just watch this.

'Til next time

If you got here and read everything then you know as much as I do. Got nothing else to show you. Whether you decided to adopt a fully functional style or not I hope you learned something that you can apply in your everyday coding.

Discussion (3)

pic
Editor guide
Collapse
gracrys profile image
Gracrys

You thinking on using some of these concepts in typescript? I think it is more "safe"....

Collapse
vonheikemen profile image
Heiker Author

Not really. I've been writing plain javascript on a small scale for far too long now. I'm more interested in the idea of composition and the things one can achieve with it.

Collapse
damxipo profile image
Damian Cipolat

The videos of Anjana Vakil are great! is interesting create a functional programming roadmap