This workshop will be retired on May 31, 2020.
What is FRP?2:32 with Amit Bijlani
Functional Reactive Programming or FRP is combination of functional and reactive paradigms. Reactive programming is programming with asynchronous data streams. Functional Reactive Programming is reacting to data streams using the functional paradigm.
[MUSIC] 0:00 Hi, I'm Amit, an iOS developer. 0:04 Today, we're going to talk about Functional Reactive Programming, big 0:07 concepts and big words that represent an intersection of two programming paradigms. 0:10 Before we dive into this world, do check out the teacher's notes for 0:16 some prerequisites for this workshop. 0:20 Be forewarned, this is an advanced workshop, and 0:22 I will be diving into the concepts behind functional reactive programming, 0:25 but you need to know some of the basics prior to gaining an understanding 0:28 of what we're talking about today. 0:32 But first, a history lesson. 0:34 Traditionally, we write code which describes 0:36 how a program should solve a problem. 0:39 Each line of code is sequentially executed to produce a desired result. 0:42 This is known as imperative programming. 0:46 The imperative paradigm forces developers to write how a program 0:49 will solve some task, the keyword being how? 0:52 Here's an example. 0:56 As you can see, to create a list of filtered numbers, we sequentially 0:57 execute a series of instructions to achieve the desired result. 1:02 Functional programming, on the other hand, is a programming paradigm where you model 1:07 everything as a result of a function that avoids changing state and mutating data. 1:11 Here's the same example using functional programming. 1:17 We feed the filter function, a closure containing a certain criteria, 1:21 which is then applied to each element, and 1:25 the resulting array contains elements that satisfy our criteria. 1:28 So you're probably wondering what is functional reactive programming. 1:32 Well, functional reactive programming, or FRP, 1:36 is a combination of functional and reactive paradigms. 1:39 Reactive programming is programming with asynchronous data streams. 1:44 Now, a data stream can be anything, gestures, keyboard input, 1:49 location updates, events. 1:52 You can listen to a stream and react to it accordingly. 1:54 So functional reactive programming is reacting to data streams using 1:58 the functional paradigm. 2:02 FRP is not a utility or just a library, it changes the way you 2:04 architect your applications and the way you think about your applications. 2:09 I know it's a lot to digest, and it's not enough for 2:13 you to know it's theoretical definition. 2:16 The best way to understand FRP is to practice. 2:18 So in the next video, we will look at a basic example, and 2:22 then we will look at another real world example, which might be a better use case. 2:26
You need to sign up for Treehouse in order to download course files.Sign up