Is Functional Programming a Good Idea?

preview_player
Показать описание
In this video I talk about the benefits and challenges of functional programming

I compare functional programming versus imperative programming, and the maintainability benefits of having code written in a functional style. I talk about pure functions some of the key methods used in functional programming, including map, reduce, recursive methods, and higher order functions.

I'm planning to make a future video about immutable data structures and the techniques that go with them, as well as functional programming vs object oriented programming. Stay tuned!
Рекомендации по теме
Комментарии
Автор

subscribed, very nice video :) although, the recursive function you showed does not meet requirements for tail call optimization - last call of the function must be the recursive call, in your case it was a call to + . Otherwise, can't wait for the next part :)

Qrzychu
Автор

This made fp so much clearer to me. I've been struggling to really grasp it. Thanks!

kylewollman
Автор

I will eagerly wait for part 2. I´ve been learning how to program and functional programming always seems like an interesting approach. Up to now i´ve been doing mostly procedural programming (as far as I can tell), and it mostly works for simple scripts, but once I need to take care fo edge-cases and higher-order functions and multiple returns, it quickly devolves into a messy code.

MyriadColorsCM
Автор

Thats the best explanaiton to side effects i have ever heared

"If you send your robot in again"

TheLPfunnTV
Автор

I watched many on FP. This is nice explanation

sumanth
Автор

amazing video! this is what I'd call a very hard stuff exposed in a very easy way. Thanks a lot

rianby
Автор

This is very well put together and informative. Your audio consistency could still use some work, but the audio quality was overall very good. I'm looking forward to the next one!

Thebuilderz
Автор

9:11 nice, similar to "why lisp" in "lisp vs algol family" video, you cleared "functional programming" too!

yash
Автор

I think you explain the concepts very clearly to people who don't know about functional programming. What's good is how you talk about the concepts without talking about any functional language and express ideas in C-style syntax and diagrams. I will use this video to introduce people to the paradigm.

DryBones
Автор

I'm fascinated by FP, and have tried to incorporate aspects of it. Unfortunately, a lot of my work is stochastic simulation of epidemics, where you have a population that changes *randomly* over time, and you want to capture various bits of information about it (e.g. maybe poll the population at regular intervals, record the time(s) an individual gets infected and recovers etc.). This is so natural in procedural, e.g. population X=X0; t=0; while (t<t_end) {calculate stuff; update t and X; record poll; etc.}, but this state fiddling is anathema to FP.

I have looked, but haven't really come across any examples of FP in these sorts of cases, to learn from. Guess when I do figure it out it'll be up to me to share my findings!

Also I remember how Guido decided that TCO wasn't going to happen in Python. Given that he's not been the BDFL for almost 5 years now, maybe that might change in the future?

spacelem
Автор

resursive implementation of fib() in 6:30 is functional as well, no?

I'd also argue that pure functional programming is not practical when applied religiously. If you localize side effects, the function can act as pure, but have a mutability associated with it. e.g. with recursive fibonaci implemntation, if you add memoization with cache private to fib(), it's no longer technically pure, but from caller's perspective it has no side effects, and better performance.

ViktorasMakauskas-vwfk
Автор

Really nice video, I thought functional programming was hard but your explanation was good

katzetante
Автор

Hmm... Good job! Most people when they assume that I havs a question: I either do not have a question at all, but you actually assumed the correct question. The question was: "Wouldn't I have to copy the entire array?"

jasonenns
Автор

7:48 > _"languages offer optimization - tailor recursion"_

wow, thats interesting.i was going to say exactly that - I like recursion, but the book always say to reduce function calls for performance.

yash
Автор

I've always thought that FP can be achieved via any of the other programming paradigms if and only if you write them correctly. BUT the _point_ of FP is that a functional rubric is *enforced* by the grammar and runtime, therefore guaranteeing code safety. Does that sound right?

iNuchalHead
Автор

In mathematics, a function is not just a "set of points in the space". For example, the function:
f(x) = 1, if x is irrational; 0 if x is rational
cannot be represented as s set of points in the space by definition

antronixful
Автор

I don't care if FP is "on a hype", or "is trendy" or something, I really damn like it, not to mention lambda calculus, which is just so awesome that it doesn't even need traditional numbers. Or booleans. Or strings. Or anything besides the way to declare a function with its params and apply it. So concise, yet so powerful.

nekoill
Автор

Functional Programming is a very important tool in every developer's toolbox. But to try and *only* use it, IMHO, is throwing away the object-baby with the bathwater.

gloweye
Автор

This video is quite a while ago now, but if I may give my 2 cents here, I would like to say something about the old debate of purity.
I believe the most important point about purity is that it's all about Separation Of Concerns.
Pure languages as a whole like Haskell have some problems in how practical they are to use in real life software development.
So what I believe is that at function level, you want to decide if it becomes a pure function or not, and express that clearly in the name and type of it.
You can often keep most code in pure functions, which just yield values in predictable ways.
Actual `work`, like modifying environmental things, files, stored data, etc. can be placed in decidated, centralized procedures in a program. And such a procedure may return void or unit (this depends on the language), or when applicable rather a success or error result status.
So I strongly believe in well organized, mixed paradigm programming. I believe Rust does this totally right for example.

jongeduard
Автор

Who compares two lists by removing their elements instead of iterating through them?

krunkle