DEV Community

Ryan Whelchel
Ryan Whelchel

Posted on

Day 26 of #100daysofcode: Functional Programming and Redux

Hey everybody!
I had a lot going on today, but I dove into Redux and Functional programming! Functional programming was particularly interesting to me; if you have never heard of functional programming before, I highly recommend watching this video as it is kind of hard to wrap your head around if you come from an object-oriented background.

Functional Programming - TL;DW

Functional programming, as I understand it, seeks to make all data objects immutable. Instead of modifying data, it takes data into functions, operates on that data and spits out new data. This may seem to be needlessly complicating things, but it has upsides. The most motivating upside that I learned about is in the case of parallel computing:

If there is a situation where 2 functions are running on separate threads, you do not have to worry about a situation where one function requires data that the other is operating on. What I mean by this is that the second function will not begin operating until the first function has finished. You don't have to explicitly tell function 2 to wait until function 1 is done, it simply cannot proceed until it receives the output from function 1.

The problem that could arise in a different programming paradigm is that function 2 would start operating on the data that function 1 is still operating on. This could cause all kinds of issues. Sure there are ways to get around this, but it seems to be a decent motivation for functional programming.

I have a very shallow understanding on Functional Programming, so I won't try to explain the mechanics of how it accomplishes the above, but I do think that it helps a lot to understand functional programming if you understand why it's trying to accomplish what is trying to accomplish.

If there are other things which functional programming accomplishes that I have left out, please leave a comment! I only started learning about Functional Programming today; this is my attempt to summarize what I have learned!

What does this have to do with Redux?

Redux is a state management library. In a way, states in general are a functional programming concept, so it may be easier to explain how states are related.

What does this have to do with Redux state?

State is a functional programming concept. Why? You may know that, at least in React, when we initialize a state we initialize the state variable itself but also a function variable to modify that state. This function updates the state for us, but it doesn't directly modify the original state. It takes our change to the state and creates a new state object, which signals the refresh. This methodology is a much easier way to detect changes to objects, which makes deciding what we need to refresh way easier.

Since Redux is a state management library, it was designed with functional programming concepts in mind.


Here is what I worked on today!

  • A few Leetcode Tree Problems
  • A bit of the debugging section of the JS Course on FreeCodeCamp - Currently about 35% of the way through the course!
  • Began learning about Redux - I started by reading a little bit about Redux. I learned that it was built on Functional Programming principles, so I jumped to learn more about that
  • Began learning about Functional Programming - I am very fascinated by this programming paradigm. Expect more notes about this in the future.


  • Continued Leetcode practice and FreeCodeCamp progress
  • Continued updates on my learning journey for Redux
  • Begin the Study Aid app! (soonTM)
  • Possibly continued updates on my learning journey in Functional Programming. This paradigm is very interesting, and I'm curious how people use it in place of object-oriented programming. I have a hard time imagining an organized coding world that is devoid of classes and inheritance!
  • Later in the challenge: AWS Deployment, AWS Certification, and Using Docker!?


JS Course - FreeCodeCamp
Redux FAQ (Surprisingly good resource)
Learn Redux - Programming with Mosh
Functional Programming in 40 - Russ Olsen with GOTO

Discussion (2)

markerikson profile image
Mark Erikson • Edited on

Redux FAQ (Surprisingly good resource)

As Redux maintainer and author of the Redux FAQ, thank you! :)

I would strongly recommend going through our official Redux core docs tutorials, which cover both "how to use Redux the right way" and "how Redux works from the ground up":

Unfortunately most other tutorials online are very outdated, although last time I looked at Mosh's course it was pretty good.

FWIW, while I'm absolutely not a Functional Programming zealot, between using React function components and Redux reducers it's been a while since I actually wrote a class from scratch of any kind.

rydwhelchel profile image
Ryan Whelchel Author

Hey Mark! It's cool to hear from you.

I have been burned by trying to learn from weak documentation, so running into such awesome documentation is a breath of fresh air. Thank YOU for putting in the effort to make a great repository of info.

It did seem like there was some varying information online about Redux (which is actually why I jumped to the FAQ to begin with). In the past, official tutorials I have seen were lacking a little context so I was hesitant to jump straight into the docs.

Yeah after creating a couple little apps in React, I can easily see how classes fade from necessity in your toolkit. I think at heart I'm still a Python programmer, and classes in Python are one of my favorite things to work with.

Thanks for the advice Mark!