Day 26 of #100daysofcode: Functional Programming and Redux
Tags: 100daysofcode, react, python, beginners
Published: 2021-12-08 02:19:30

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](https://www.youtube.com/watch?v=0if71HOyVjY) 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.

## Today
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.

## Upcoming
* 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!?

### Resources
[JS Course - FreeCodeCamp](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/)
[Redux FAQ (Surprisingly good resource)](https://redux.js.org/faq)
[Learn Redux - Programming with Mosh](https://www.youtube.com/watch?v=poQXNp9ItL4)
[Functional Programming in 40 - Russ Olsen with GOTO](https://www.youtube.com/watch?v=0if71HOyVjY)