turingschool / front-end-curriculum

Turing Front-End Engineering Curriculum
http://frontend.turing.io
110 stars 121 forks source link

Feature/pure functions lesson #604

Closed Kalikoze closed 1 year ago

Kalikoze commented 1 year ago

Description of Changes

I've included a new lesson on Pure functions including definitions of what a pure function is, what are side effects, along with a list of examples for students to work through. It also talks a bit about the pros of pure functions, what are some common red flags, and hints at the function programming paradigm.

Commentary

My idea was that this would be a lesson taught later in M1 after they've had some practice writing out functions. Ideally they can use this lesson as a way to refactor their functions and focus more on FP practices for their group project. While I did include examples in the lesson, my guess is the instructors and student would run the code in Repl.

I tried to build this lesson so that much of it was discussion based, where students could experiment and put their own definitions to what is happening as well as help them practice predicting when a function does and does not have side effects. I tried to keep examples simpler to what they may come across, but think that this is a lesson that could be revisited in M2 to talk about more complex examples such as network requests or even randomness using something like Math.random(). M2 could also be a great opportunity to revisit avoiding mutations especially after focusing more on prototype methods.

Questions for reviewers

Closes #599

nicktu12 commented 1 year ago

Nice job Travis! After implementing some of Will's suggestions this one LGTM!

sertmer commented 1 year ago

This is such a great start Travis! Thanks for writing it up!

netlify[bot] commented 1 year ago

Deploy Preview for sage-cupcake-e1a0c3 ready!

Name Link
Latest commit 43f4be7a9951ece3c3e386979655c2e49eac3fc2
Latest deploy log https://app.netlify.com/sites/sage-cupcake-e1a0c3/deploys/63ec0ec17b576f0008257f56
Deploy Preview https://deploy-preview-604--sage-cupcake-e1a0c3.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Kalikoze commented 1 year ago

Updates have been made based on previous feedback! I accidentally merged in the latest changes from gh-pages into this branch as well, so the timeline is a bit off. Apologies on that, let me know if I should rewrite any of the timeline. I'll make sure to branch off from development in the future, but I believe this is ready to be merged in!