
Kyle Simpson – [Frontend Masters] – Functional-Light JavaScript, v2
English | Size: 1.43 GB
Category: Comp: Web Development
Learn the fundamentals of functional programming in javascript in this (updated, version 2) of the course with Kyle Simpson — Author of “You Don’t Know JS” book series — to write more flexible and effective code. Kyle covers the core of functional javascript with concepts like pure functions, .map() .reduce() .filter(), recursion and function composition. Plus go even deeper with advanced functional programming concepts like fusion, transducing and monads! This course is for experienced javascript developers who want to learn how to employ more trustworthy and verifiable code, plus enhance readability of that code.
Published: August 14, 2017
7 hours, 24 minutes
Table of Contents
Introduction
Kyle Simpson introduces his Functional javascript course and talks about the importance of function playing the pivotal role about how data flows through an application.
Functional Programming Introduction
Functional Programming
Kyle discusses why learning Functional Programming (FP) is essential to becoming a better programmer. FP is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. Functional programming is declarative rather than imperative, and application state flows through pure functions. Declarative code focuses on what happens while Imperative code is focusing how something should happen.
Provable and Readable
Kyle explains that writing code that you don’t understand is code that you cannot trust and vice versa. By using Functional Programming through mathematically proven patterns, programmings can trust their code. Kyle takes questions from students about abstraction.
Pure Functions and Side-Effects
Underscoring pure functions are at the heart of functional programming, Kyle states that the first step in learning how to write pure functions is to understand what makes a function impure or have side effects. For example, a function that alters variables outside of its scope is an impure function.
Purifying Functions
Kyle reviews how to purify a function removing side effects, but the tradeoffs include pragmatic approach.
Challenge 1: Purify a Function
In this challenge, students purify a function by creating a pure function named “bar” to wrap around the function “foo.”
Challenge 1: Solution
Kyle walks through the solution to Challenge 1.
Evolving Understanding of Impurity
After the exercise, Kyle continues to explore the potential pitfalls of coding pure functions and judging its purity relies on the context of the application.
Managing Function Inputs
Arguments
The order of arguments matter, Spreading Properties
No Points
Kyle reviews tacit programming or “point-free” style as it is commonly called. The term “point” refers to a function’s parameter.
Challenge 2: Point-Free style
In this challenge, students refector functions into point-free style.
Challenge 2: Solution
Kyle walks through the solution to Challenge 2.
Composition Introduction
Functions come in different shapes and sizes, Kyle illustrates how to combine functions to make a new compound function as a utlitilty in various parts of a program. This method of using functions in this manner is called composition.
Challenge 3: Compose and Pipe Utility
In this challenge, students code their own compose and pipe utilitiy.
Challenge 3: Solution
Kyle walks through the solution to Challenge 3.
Immutability
Immutability Introduction
To a functional programmer, Kyle explains that immutability refers to a variable’s ability to be changed. Kyle illustrates this by explaining the difference between using the “const” keyword and using object.freeze(). – http://Facebook.GitHub.io/immutable-js
Challenge 4: Compose and Pipe
In this challenge, students code their own compose and pipe utilitiy.
Challenge 4: Solution
Kyle walks through the solution to Challenge 4.
Closure
Closure and Side Effects
Kyle reviews closure, which is when a function “remembers” the variables around it even when that function is executed elsewhere. While using closure is a very powerful technique, Kyle demonstrates that side-effects can be produced and how closure can be written in a more pure way.
Challenge 5: Purifying Closure
In this challenge, students rewrite a closure to be more pure.
Challenge 5: Solution
Kyle walks through the solution to Challenge 5 and takes questions from students.
Partial Application
Generalized to Specialized
Kyle demonstrates using partials as a technique to specialize a generalized function. Then Kyle shows that currying, while a similar technique, is where a function that expects multiple arguments is broken down into successive chained functions that each take a single argument.
Recursion
Recursion Introduction
Kyle introduces the concept of recursion, which is when a function calls itself to perform an operation and it will continue to call itself until a base case is reached.
Challenge 6: Recursive Operation
In this challenge, students take create a recursive operation.
Challenge 6: Solution
Kyle walks through the solution to Challenge 6.
Proper Tail Calls
Kyle reviews Proper Tail Calls (PTC). A tail call occurs when a function calls another as its last action, so it has nothing else to do. A PTC does not need any extra stack space when doing a tail call.
Continuation Passing style
Kyle illustrates Continuation Passing style (CPS), which is organizing code so that each function receives another function to execute at its end.
Trampolines
In demonstrating trampolines, Kyle shows that CPS-like continuations are created, but instead of passed in, they are shallowly returned.
Data Structures
List Transformations
Kyle introduces the Array.map() method and explains how it can be used to create immutable list transformations. Transforming a list involves performing an operation on every value in that list. The new list of transformed values has a one-to-one “mapping” with the original list.
Filter: Exclusion
Kyle reviews the Array.filter() as a method used to create list exclusions. Each item in the list is passed to a function which returns a boolean value representing whether that item should be included in the list or not. A new list of these filtered items is returned, leaving the original list unmodified.
Reduce: Combining
Kyle introduces Array.reduce() method as a combiner. Just like the map() method, reduce() iterates through a list performing a transformation on each value. The difference is an initial value is also passed which the items are composed onto creating a smaller, “reduced” list or even a single return value.
Challenge 7: Culmination Exercise
In this challenge, students work through a number of the concepts taught throughout this course. Before starting the exercise, Kyle shares a few observations about the process of learning functional programming.
Challenge 7: Solution
Kyle begins walking through the solution by creating an addn() function that takes an array of values and adds them together using the add2() function.
Challenge 7: Solution 2
Building off the previous solution, Kyle changes the addn() function to now work with an array of functions instead of an array of values creating an appraoch that allows the incorporation of the reduce() method. – Tthere’s a horn that starts at 04:53:33:20 and lasts till 04:58:35:13
Challenge 7: Solution 3
The last step in the exercise 4 solution is to incorporate the filter() method so only odd or even values can be passed to addn().
Fusion
Kyle introduces the concept of fusion, which deals with combining adjacent operators to reduce the number of times the list is iterated over.
Transducing
Kyle shows how to create transducers, which are composable and efficient data transformation functions that do not create intermediate collections.
Data Structure Operations
Data Structure Operations Introduction
Kyle reviews lists, which are typically visualized as arrays, but can be generalized as any data structure that represents/produces an ordered collection of values. As such, all these “list operations” are actually “data structure operations.”
Challenge 8: Culmination Exercise 2
In this challenge, students take all the concepts discussed in the course and use them to solve a coding exercise.
Challenge 8: Solution
Kyle walks through the solution to Challenge 8 and takes questions from students.
Functional Programing Utility
FPO.js
Kyle introduces his FP library, FPO.js, whose methods are all styled to use named-arguments (object parameter destructuring) instead of individual positional arguments
Async Programming
Lazy Arrays
Kyle illustrates that “eager” and “lazy” are ways to describe whether an operation will finish right away or progress over time. A “lazy array” is an array where the values will come in over time.
Challenge 9: Observables
In this challenge, students program a countdown timer using observables.
Challenge 9: Solution
Kyle walks through the solution to Challenge 9 and takes questions from students.
Wrapping Up Functional javascript v2
Wrapping Up
Recapping the course, Kyle highlights the key concepts discussed in the course.
DOWNLOAD:
http://rapidgator.net/file/5ab5c8f1430d496191dd1600b80a0d66/%5BFrontend_Masters%5D_-_Functional-Light_JavaScript_v2.part1.rar.html
http://rapidgator.net/file/e5cd7d4262ee9da3f4fa7dadfe527796/%5BFrontend_Masters%5D_-_Functional-Light_JavaScript_v2.part2.rar.html
http://rapidgator.net/file/368408a000b3fbae9e3c3cb001645928/%5BFrontend_Masters%5D_-_Functional-Light_JavaScript_v2.part3.rar.html
http://nitroflare.com/view/C3F3705D464AF0B/_Frontend_Masters__-_Functional-Light_JavaScript_v2.part1.rar
http://nitroflare.com/view/6B0F48814B04624/_Frontend_Masters__-_Functional-Light_JavaScript_v2.part2.rar
http://nitroflare.com/view/98585CFC18B60B2/_Frontend_Masters__-_Functional-Light_JavaScript_v2.part3.rar
If any links die or problem unrar, send request to http://goo.gl/aUHSZc
Leave a Reply