Home > Latest Articles > Functional JavaScript for Lazy Developers (Like Me)

Functional JavaScript for Lazy Developers (Like Me)

Functional JavaScript, a Remedy for the Lazy

One of the core concepts that has driven my quest for knowledge about programming techniques has always been my own laziness. After all, what attracted me to computers back when I first started playing with them was the notion that they could do things for me. All I had to do was sit back and tell them what I wanted.

But I quickly learned that computers were very literal. Unless I told them exactly what I expected in explicit and unambiguous terms, using a language that they understood, they would rarely give me back what I had in mind. And being lazy, I didn’t want to work any harder than I had to, to express my intentions.

I had then seen JavaScript go from a few imperative one-liners to large and convoluted object-oriented applications, and there seemed to be no end in sight to the complexity.

I started to look for ways to make coding easier and more fun. And that search led me directly to functional programming.

New Ways to Look at Problems

I was first introduced to functional programming when I was a senior front-end engineer working at a small start-up in San Francisco. One day, a programming wizard who labored deep in the bowels of the company’s research group heard me complaining about some of the messy state-dependent code I was working on, and lured me into a conference room with fancy promises. There, he proceeded to give me an impromptu three-hour¬†introduction to Haskell, a classic functional programming language, including a cursory explanation of the philosophy of functional programming.

He mystified me with tales of functors and monads as I watched variables disappear, and methods split apart and merge together under unfamiliar type signatures. At the time it all seemed like strange sorcery, but he reassured me that JavaScript also had functional capabilities and that they would lead me to salvation.

That promise kept me going as I started to dig into this exotic realm. I believed that functional programming techniques could offer me better ways to break a problem apart and solve it in tiny, focused bites. I was thrilled by the possibility that I could make my code cleaner, more portable, more manageable, more readable, and easier to maintain.

All along the way, I discovered some wondrous things about functional programming in JavaScript, which I’ll delve into today.

Read Full Article

admin
The WebRecital is a dedicated User Interface/User Experience professionals who come together to provide design and research workshops, portfolio reviews, and educational outreach to the greater Seattle area.
http://webrecital.com/

Leave a Reply

Your email address will not be published. Required fields are marked *