Hardcore Functional Architecture Patterns in JavaScript (2020)
WEBRip | English | MP4 | 1920 x 1080 | AVC ~445 kbps | 29.970 fps
A_VORBIS | 192 Kbps | 48.0 KHz | 2 channels | 4h 10mn | 1.17 GB
Genre: eLearning Video / Development, Programming
Learn patterns to architect your JavaScript programs using functional programming techniques. In this course, you’ll libraries and applications using functional programming patterns. You’ll also learn new tools to apply, such as Monoids, Monad Transformers, Free Monads, and Lenses. See functional programming in action!
Published: April 3, 2020
Table of Contents
Introduction
Introduction
00:00:00 - 00:06:16
Introduction
Brian introduces the course by explaining that architecture is about grouping things, and gives a refresher on the main functional programming properties.
Naming & Grouping
00:06:17 - 00:11:43
Naming & Grouping
Brian introduces the identity functor, and explains that it takes a value and returns a value. The identity functor is founded on category theory, which states that functional programming necessitates both composition and identity.
Composition Architecture
00:11:44 - 00:16:35
Composition Architecture
Brian compares working with one big function that does all the work with little functions that represent small functionalities from a given application, and says that this course will focus on composition involving multiple small functions.
Normalize Effect Types
00:16:36 - 00:18:00
Normalize Effect Types
Brian explains that normalizing the effect types within the app is a good guiding principle to allow every element within the app to compose, and says that different ways to solve this issue will be reviewed in the next sections.
Semigroups & Monoids
What is a Semigroup
00:18:01 - 00:21:52
What is a Semigroup
Brian explains that a semigroup is a structure that contains an associative operation, and that is closed. Explanation is given for why a closed and associative.
Creating Semigroup Data Types
00:21:53 - 00:26:33
Creating Semigroup Data Types
Brian explains how to lift an operation through a type to be able to program an interface.
Defining Empty Identity
00:26:34 - 00:33:23
Defining Empty Identity
Brian explains that monoids are semigroups with an identity, and live codes examples of monoids.
foldMap
00:33:24 - 00:35:06
foldMap
Brian explains that foldMap takes elements, maps them into a certain type, and then folds them.
Semigroup vs Monoid
00:35:07 - 00:36:46
Semigroup vs Monoid
Brian explains the main differences between a monoid and a semigroup. A semigroup can have an empty identity.
Identity Functor
00:36:47 - 00:41:50
Identity Functor
Brian explains that functors are monoids, and demonstrates the advantages of programming to an interface. Programming to an interface means referring to a more abstract level than a class.
Concat Method
00:41:51 - 00:53:29
Concat Method
Brian demonstrates how to concat different functors together, and how to use the concat method to join different monoids.
Monoid Exercises
00:53:30 - 00:53:47
Monoid Exercises
The students are instructed to code different monoid exercises.
Monoid Solutions
00:53:48 - 01:07:28
Monoid Solutions
Brian live codes the solutions to the monoid exercises.
Monoid Use Cases
01:07:29 - 01:13:04
Monoid Use Cases
Brian shares two use cases for monoids to demonstrates how monoids can be used in everyday code and make code cleaner.
Homomorphisms & Monads
01:13:05 - 01:14:31
Homomorphisms & Monads
Brian gives an example of a homomorphism. A homomorphism takes two elements and combines them then goes through a type transformation. At a high level, when combining a monoid operation and flattening two types, these types become monads.
Creating a Validation Library
01:14:32 - 01:23:24
Creating a Validation Library
Brian demonstrates how to architect an app around validation, and builds a validation library that combines different kinds of validations, and provides errors or a final object.
Creating Success & Fail Monoids
01:23:25 - 01:28:45
Creating Success & Fail Monoids
Brian demonstrates how to create success and failure types, and adds a concat method, therefore building two monoids.
Creating the Validation Monoid
01:28:46 - 01:36:05
Creating the Validation Monoid
Brian continues to develop the validation library, and demonstrates how to create a validation monoid.
Function Modeling
Function Modeling
01:36:06 - 01:43:49
Function Modeling
Brian explains that, instead of modeling data, it is possible to model a function. Functional modelling allows to use different methods.
The Reader Monad
01:43:50 - 01:48:36
The Reader Monad
Brian demonstrates how to use the Reader monad to add dependency connections and thread invisible environments through an entire program.
The Endo Functor
01:48:37 - 01:53:50
The Endo Functor
Brian explain that the endofunctor is called endo because it only works with the same kind of types.
contramap
01:53:51 - 01:59:15
contramap
Brian explains that contramap maps over inputs, combines two reducers that were previously contermapped demonstrating that contermap hits arguments before it comes in.
Function Modeling Practices
01:59:16 - 02:13:54
Function Modeling Practices
Brian live codes function modeling and demonstrates how to use Endofunction, predicate, and how to use the contramap or contravariant functor. An endofunction is a function that has an equal domain and codomain.
Function Modeling Equivalences
02:13:55 - 02:21:44
Function Modeling Equivalences
Brian demonstrates how to combine reducer functions, and transform them into an Endo type, and explains that the two are equivalent.
Composing Functors
02:21:45 - 02:26:37
Composing Functors
Brian explores different types of functors using the map, extract and fork methods, and explains that functors have different identities, can be composed together, and have a category within which they act like functions.
Monad Transformers
02:26:38 - 02:35:24
Monad Transformers
Brian explores the use of monad transformers with the Task transformer which contains a lift method that will avoid duplicating an inner type. A transformer is a monad that merges two monads together. Transformers are needed because unlike functors, monads do not compose.
Reconstructing with Monad Transformers
02:35:25 - 02:41:01
Reconstructing with Monad Transformers
Brian introduces monad transformer based libraries, and explains that each transformer is useful for a specific task, and reconstructing code with monad transformers requires understanding which transformer to use at the right place.
Monad Transformers Practices
02:41:02 - 02:47:12
Monad Transformers Practices
Brian covers monad transformer practices, and demonstrates how to use the lift method.
Defining the Free Monad
02:47:13 - 03:00:02
Defining the Free Monad
Brian explains that the free monad is a way to treat functions like datatypes, and gives an example of a free monad that takes a url as an argument, returns a datatype, and the content of the argument, in this example, the url.
Lenses
03:00:03 - 03:08:11
Lenses
Brian explains that lenses are built on functors and, compose backwards going left to right, adds that it is possible to write an entire application with lenses, and demonstrates how to treat properties as functors.
Monadic Web Apps
Building a CLI App
03:08:12 - 03:16:49
Building a CLI App
Brian explores how to build a CLI blog for creating and viewing blogposts by focusing on the architectural decisions to build the app in a functional way.
Refactoring Recursive Tasks
03:16:50 - 03:29:11
Refactoring Recursive Tasks
Brian continues building the CLI blog and uses different forms of function modeling to refactor code, such as the fix type.
Free Monads
03:29:12 - 03:42:55
Free Monads
Brian continues to refactor the CLI blog app using Free monads to test the different app tasks.
Interpreters
03:42:56 - 03:49:54
Interpreters
Brian adds interpreters to the different free monads. Interpreters allow developers to log information about how the Free monad runs.
Creating an Alternative Redux
03:49:55 - 03:57:02
Creating an Alternative Redux
Brian explores a new application and starts building an alternative Redux that is contained in the event loop. Redux is a bare-bones approach to functional UI. The alternative takes advantage of monads, function modeling, monoids, and lenses.
Using the ask Method & Lenses
03:57:03 - 04:07:45
Using the ask Method & Lenses
Brian continues to build the application started in the previous section so that state is merged automatically when the ask method runs, uses lenses to alter state in an elegant and immutable way, and builds reducers that compose and are unary functions.
Wrapping Up
Wrapping Up
04:07:46 - 04:10:49
Wrapping Up
Brian wraps up the course, explains that the purpose of this class was to give examples of functional architecture that can be reused at work, and explains when to use JavaScript vs when to use TypeScript in functional architecture.
发布日期: 2020-04-14