Start using functional style in your existing code base today, using the “functional sandwich” principle.

Photo by Eiliv-Sonas Aceron on Unsplash

There’s one functional programming principle you ought to know, no matter which is your favorite programming paradigm. Surprisingly, it’s not a super-advanced, abstract, mathematical mischief. Rather, it is the most basic principle of functional programming.

Although simple, it is very powerful and I believe I write better code since I started using it as often as I can.

I remember learning redux a few years ago. It was the first time I heard the term “pure function”. I was hooked immediately. It all made perfect sense… Composition, immutability, pure functions, it all looked so elegant and just…right.

I started learning…

A functional approach to promise.then

Photo by N. on Unsplash

Promises are a fundamental building block in almost every javascript application. Even with the emergence of modern syntax like async/await, understanding the workings of promises is the key to writing async code effectively.

I believe the most confusing part, and the most important to understand, is the promise’s then method. It is the main and most basic way of interacting with a promise.

In this article, I’ll try taking a different, more functional, approach to explain how the then method actually works. …

Omer Dolev

Fullstack Developer @ WalkMe

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store