Gordon  Taylor

Gordon Taylor


How to Write Better JavaScript using Plumbing Techniques

A mind is a terrible thing to waste, and one of the fastest ways to do it is not keeping it open enough. Although most of my development career I’ve spent writing in JavaScript and I love this language, I’ve never considered myself a JavaScript developer. I never had problems with writing in Java, Python, or C## when there was a need, and I also like to explore languages that I don’t have knowledge about and try to get the best out.

This was exactly the case with Elixir — one of my colleagues in my previous company talked me into taking an online course about Elixir, and I liked it very much — it has cool language features like list comprehensions, advanced pattern matching, but the one that I’ve resonated most with was definitely the pipe operator. Unfortunately, I didn’t have much opportunity to write in Elixir at work, but I found ways to use what I’ve learned while writing in JavaScript. Read on to find out!

Photo by Abhi Bakshi on Unsplash

The first concept that I’d like to make you familiar with to get going is function currying (the name, surprisingly, not coming from a popular Indian dish, but rather from an American mathematician and logician, Haskell Curry). I’ll explain what it’s useful for in a moment, for now all that we need to know is that currying a function with a fixed number of arguments makes it possible to pass arguments in more than one call.

#development #programming #javascript

How to Write Better JavaScript using Plumbing Techniques