/Becoming-Functional

This is the second part of the Functional Programming introduction, and a more practical approach than theory one.

Becoming functional

"Why bother calculating πœ‹ to 100 places if there's no way anyone can read it? To print it out somewhere, we need to write to a console, or send data to a printer, or something where someone can read it. And, what good is a database if you can’t enter any data into it? We need to read data from input devices, and request information from the network. We can’t do any of it without side effects. And yet, functional programming is built around pure functions. So how do functional programmers manage to get anything done?

The short answer is, they do what mathematicians do: They cheat." - James Sinclair


ACTIONS


Here there is a list of Actions that we can consider to have in mind if we want to get into Functional Programming.

ADVICE

Open up your minds to the possibility of a world made up solely of "functions" an alternative model of the world.
Please don't rush. Take your time.

Functional programming isn't a specific tool, but a way of writing code. Learning FP sometimes is a bit cryptic and code looks weird in the beginning. Learning Functional Programming takes a while to master it and some other times we need to stop doing what we used to do, moving away from old habits is the hardest part, and try a different way of doing the same thing, pushing ourselves out of the comfortable zone. So, please be patient and open your mind. 

This is the second part of the Functional Programming introduction and a more practical approach than theory one. For the first approach to Functional Programming please have a look at Functional (Programming) Mindset - An introduction to Functional Programming


CONTENT:

Chapter Topic
ALL LINKS ALL LINKS
do better ifs do better ifs
do compose functions do compose functions
do declarative programming do declarative programming
do follow general suggestions do follow general suggestions
do no loop statement do no loop statement
do not shared state do not shared state
do not switch case do not switch case
do avoid use var nor let do avoid use var nor let
do recursion do recursion
do remember terminology do remember terminology
do rest operators do rest operators
do spread operator do spread operator
do use immutable update utility libraries do use immutable update utility libraries
do use memoization do use memoization
do avoid using mutating methods do-avoid-using-mutating-methods
do use readonly keyword do use readonly keyword
do freeze to avoid mutation do freeze to avoid mutation
do use type system do use Hindley-Milner type

OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts. Michael Feathers (Twitter)


Further Related links:

Why Functional Programming:

Why functional programming matters
Why Functional Programming?
Advantages of Functional Programming
Pros and cons of functional programming
What are the benefits of functional programming?
Switching from OOP to Functional Programming

SOLID and FP:

SOLID: the next step is Functional
Goodbye, Object Oriented Programming

BOOKS

Mostly Adequate Guide to Functional Programming
Thinking in Ramda
Professor Frisby Introduces Composable Functional JavaScript
Functors, Applicatives, And Monads In Pictures
Essential Functions Support

Curry function:

Curry and Function Composition
Why Curry Helps
Perpetual Currying in JavaScript

Further more documentation:

Open Source JS Resources


πŸ’― Thanks!

Now, don't be an stranger. Let's stay in touch!

I'm a passionately curious Front-end Engineer. I like sharing what I know, and learning what I don't. London, UK.

πŸ”˜ linkedin: @LeoLaneseltd
πŸ”˜ Twitter: @LeoLaneseltd
πŸ”˜ Portfolio: www.leolanese.com
πŸ”˜ DEV.to: dev.to/leolanese
πŸ”˜ Blog: leolanese.com/blog
πŸ”˜ Questions / Suggestion / Recommendation: developer@leolanese.com