What is Functional Programming?1:57 with Kenneth Love
Functional programming is often a scary concept to a lot of programmers. Let's figure out exactly what we mean by it before we start learning.
Functional programming is a popular approach in a lot of languages and is even the main approach in some. If you find you like functional programming, check out the languages Haskell and Scala.
[MUSIC] 0:00 Hi, I'm Kenneth, the Treehouse Python teacher, and I have a secret to confess. 0:04 Some developers program because it makes our other jobs easier. 0:10 Or, maybe we do it because it's a good way to make money. 0:13 Or, it scratches a problem solving itch. 0:15 But, for a lot of us, 0:18 myself definitely included, we do it because it makes us feel really cool. 0:19 I mean, we type a few words, and we get a neat website or application that does so 0:23 much for us. 0:27 Honestly, this magic is a big part of what I like about functional programming. 0:29 Functional programming, 0:33 sometimes abbreviated as FP, is one of a few major approaches to programming. 0:34 You've probably used two of the others already. 0:38 Procedural programming is where most of start out. 0:41 Your program just works its way from top to bottom evaluating each line. 0:44 Maybe there are some functions, but they're used for repetitious work. 0:48 And you've probably come across object-oriented programming 0:51 where concepts are broken up into objects, and then those objects have attributes and 0:54 methods that do the work. 0:57 Both of these approaches are useful in their own ways, and we've done, 1:00 and will continue to do, both of them here on Treehouse. 1:03 Functional programming though, 1:06 is a slightly different approach to programming. 1:07 We're gonna talk more about the rules of functional programming in the next video. 1:10 But I want you to understand, despite what you might see in more fanatical blogs or 1:13 guides on the Internet, or in other languages. 1:17 In Python, functional programming is just another set of 1:20 tools to keep in your pocket for problem solving. 1:22 Just to set some expectations, 1:25 this course is going to be a bit more theory heavy than other courses. 1:27 We'll still be writing plenty of code, but we have to establish some ground rules and 1:30 approaches up front so that we can get the best benefit from our code. 1:34 Also, many of our examples will be more about here's a useful approach 1:39 then us working together one step at a time to solve a final problem. 1:42 I found over the years that functional programming usually isn't an end 1:47 in and of itself. 1:50 It's just another superpower to use when you need to do a lot of amazing work with 1:51 just a bit of code. 1:55
You need to sign up for Treehouse in order to download course files.Sign up