Functional Programming for Pragmatists • Richard Feldman • GOTO 2021

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 79

  • @GOTO-
    @GOTO-  3 วันที่ผ่านมา

    Looking for books & other references mentioned in this video?
    Check out the video description for all the links!
    Want early access to videos & exclusive perks?
    Join our channel membership today: th-cam.com/channels/s_tLP3AiwYKwdUHpltJPuA.htmljoin
    Question for you: What’s your biggest takeaway from this video? Let us know in the comments! ⬇

  • @michaelwatson4218
    @michaelwatson4218 2 ปีที่แล้ว +60

    Richard Feldman is an excellent teacher. I always learn something from him. It's a good feeling when the light bulb lights up.

  • @mostafatouny8411
    @mostafatouny8411 5 หลายเดือนก่อน +1

    Clear, concise, and to the point. Nice how it shows the pragmatic utility using code snippets.

  • @elliotbarlas
    @elliotbarlas 2 ปีที่แล้ว +10

    Excellent summary of the merits of functional programming for the pragmatist.
    I wish this wisdom replaced the conventional wisdom of Uncle Bob's Clean Code, which is filled with counterexamples. That text seems to revel in solving a problem with the most mutations.

  • @imadetheuniverse4fun
    @imadetheuniverse4fun 2 ปีที่แล้ว +3

    18:00 "It's just the thing that would be coming out of the look-up table is a task". That's eye-opening for me, thank you.

  • @emanuelerabino3909
    @emanuelerabino3909 2 ปีที่แล้ว +30

    Inspiring talk. In my opinion the whole industry needs this kind of pragmatic and moderated approach in explaining the value and benefits of FP, instead of fideistic battles.

    • @gabrielalejandrobernalpere3018
      @gabrielalejandrobernalpere3018 11 หลายเดือนก่อน +1

      The point is that, in general, people don't want to get out of their comfort zone and embrace OOP with blind faith. Many don't even care about improving. It's a matter of attitude towards continuous improvement.

  • @diavolokelevra4795
    @diavolokelevra4795 ปีที่แล้ว +7

    Love the fact that the most replayed sections are about the drawbacks

    • @lockbert99
      @lockbert99 ปีที่แล้ว +1

      How do you see which sections are played the most?

    • @JDogB-tc3lx
      @JDogB-tc3lx 5 หลายเดือนก่อน

      So the whole thing?

  • @jaymanx4life
    @jaymanx4life 2 ปีที่แล้ว +5

    Elm sounds too good to be true. Will def. pick this up over the weekend.

  • @bwfrieds
    @bwfrieds 2 ปีที่แล้ว +7

    37:30 is the main point. Limitation is power. Great talk.

    • @bwfrieds
      @bwfrieds 2 ปีที่แล้ว

      @@indicted_ham_sandwich Ultimate power ultimately corrupts.

  • @hughoxford8735
    @hughoxford8735 10 หลายเดือนก่อน +1

    I choose functional techniques out of fear

  • @codingedgar4878
    @codingedgar4878 2 ปีที่แล้ว +4

    Richard Feldman is the best

  • @austinnar4494
    @austinnar4494 2 ปีที่แล้ว +2

    One benefit that I would love to see a language add: In pure functional languages you can automatically skip computations that do not lead to any effect. You can treat the entire program as a directed graph where the function calls are nodes and the edges are values. Any node that does not have path to a task (something that produces user-visible output) can be removed from the graph without affecting the program

    • @thiagomiranda3
      @thiagomiranda3 ปีที่แล้ว

      This already exist, it's called lazy evaluation

  • @teial
    @teial 5 หลายเดือนก่อน

    The key here, I think, is the part about dependencies. Either they are implicit (which might bite us back), or we make them explicit but introduce verbosity instead (which can lead to confusion). So it is a tradeoff, as usual. We can sort of circumvent it by making PL itself bear the burden of providing developers with explicit and clear abstractions for dependency management (like algebraic effects and *not* like Haskell's do-notation). But this means that either 1) developer must spend more time learning the language which is sort of okaish or 2) PL developers need to spend more time designing the language.

    • @teial
      @teial 5 หลายเดือนก่อน

      In addition to what I said before, if we rely on PL for abstractions to manage implicit dependencies, we'd better have a way to quickly adapt or change the language to match the task. There can be no universal functional PL of course, so isn't it better to have a way to quickly design one for the task at hand? So far I haven't found anything like that. Racket sort of tries to do this with language-driven development but I don't think it worked out well. We need better tools. Like LLVM but for FP, or multi-stage programming with multilayer macro system to modify the language. And better IDEs for all of that, of course. Unfortunately, there's very little research going on in this area. A pity, I blame LLMs for drawing postgrad attention in the wrong direction.

  • @gdargdar91
    @gdargdar91 2 ปีที่แล้ว +39

    What this guy does would definitely be the next big thing for the evolution of the developer society if they listen. Sadly, today's developers are more attracted to all those shiny new JS frameworks that are garbage in reality.

    • @michaelwatson4218
      @michaelwatson4218 2 ปีที่แล้ว +8

      I think it's hard for an imperative programmer like me to get their head around it. For example, the discussion of promises in JavaScript vs tasks in Elm. With JS you're telling the computer what to do, with Elm you're describing what you want done and the computer figures out how to do it later. I had to sleep on it before I understood what he was saying. It's a shift busy developers don't have time to make, but I agree, they should take the time to understand it.

    • @gimlam5909
      @gimlam5909 2 ปีที่แล้ว +2

      Conversely, the shiniest, newest framework might actually be the only suckless js framework so far - Svelte.

    • @MeNumber47
      @MeNumber47 2 ปีที่แล้ว

      @@gimlam5909 Svelte is a framework that compiles to JS in order to gain performance and a more comfortable syntax. Elm has already been doing that for years. If you put some time on it, i promise you it'll be worth it

    • @pengain4
      @pengain4 ปีที่แล้ว +1

      ​@@MeNumber47Elm is great but it has a steeper learning curve, unusual syntax and requires accepting mental paradigm shift. Who was "compiling to JS first" is not a settling point at all. ;)

  • @shahidkhan0219
    @shahidkhan0219 2 ปีที่แล้ว +5

    he really convinced me about functional programming

  • @mortenbrodersen8664
    @mortenbrodersen8664 2 ปีที่แล้ว +14

    Another excellent talk from Richard Feldman!

  • @MarkusBurrer
    @MarkusBurrer 2 ปีที่แล้ว +3

    I love to listen to this guy. But I should start coding

  • @savkelita
    @savkelita 2 ปีที่แล้ว +13

    Great video and speech! Thank you Richard.

  • @dawid_dahl
    @dawid_dahl 2 ปีที่แล้ว +6

    Excellent talk!

  • @SimGunther
    @SimGunther 2 ปีที่แล้ว +22

    This is a great nuance knowing you have functional AND imperative stuff in your toolbox as you'd default to functional programming for the very reasons he discussed. Nice talk!

  • @DomainObject
    @DomainObject 2 ปีที่แล้ว +3

    Fantastic talk! Hear, hear. 👏

  • @bicatu
    @bicatu 2 ปีที่แล้ว +3

    how about integration tests? unless your program does not interact with any external dependency they will still be flaky as it depends on the actual behavior of other things outside your function, right?

  • @ruiw4263
    @ruiw4263 2 ปีที่แล้ว +2

    is managed effect just like a thunk (wrapper fn) scheduled by main function? At 21:48, when Richard talked about simulation, it sounds like a stubbing in oop.

  • @andihofacker
    @andihofacker 2 ปีที่แล้ว +4

    A very good talk, thank you! Concise presentation, clearly laid out thoughts.

  • @atrucktive
    @atrucktive ปีที่แล้ว

    Great talk and proving specially if you are a JS dev 34:40

  • @JessicaSunlight
    @JessicaSunlight 6 หลายเดือนก่อน +1

    Switched to functional programming because of the time you waste on debugging and side effects. In imperative 95% debugging 5% typing your dream code, in functional 95% typing dream code 5% debugging. 🤭♥
    I recall trying to use C# as a pure functional style but it never truly worked, the same story as he had with JS. It's just doesn't work. C# has matured a lot and took a lot of ideas from functional paradigm but you still wasting a lot of time on trivial things that can easily brake everything, in functional language they just don't exist. As the guy said - you just don't think about those things any more.

  • @Dannnneh
    @Dannnneh ปีที่แล้ว +1

    About global variables, it's only accessible to functions in files that are linked to the file containing the global variable, not all functions in the program.

  • @jackgenewtf
    @jackgenewtf ปีที่แล้ว +2

    I think you know this, Richard, and probably just want to avoid introducing too much terminology into the talk. But I just wanted to point out that at 28:49, technically, if the function has side effects, it isn't "pure", it is "idempotent" though, which I believe is what you meant.

  • @Pedritox0953
    @Pedritox0953 2 ปีที่แล้ว +2

    Good video !

  • @cozyrain410
    @cozyrain410 2 ปีที่แล้ว +1

    so avoid side effects and mutations makes it fp style?

    • @cozyrain410
      @cozyrain410 2 ปีที่แล้ว +1

      @@indicted_ham_sandwich thanks

  • @Cookipolation
    @Cookipolation 2 ปีที่แล้ว +2

    Memoization and parallelization can't quite be simultaneous features of thread safe pure functions :)

    • @brendanhansknecht4650
      @brendanhansknecht4650 2 ปีที่แล้ว +5

      I don't think that is accurate. You can always memoize per thread or have a thread safe map that is depended on for memoization. It should just a be a question of how it is supported/implemented by the language.

    • @Cookipolation
      @Cookipolation 2 ปีที่แล้ว

      @@brendanhansknecht4650 you're proposing impure solutions

    • @brendanhansknecht4650
      @brendanhansknecht4650 2 ปีที่แล้ว +4

      @@Cookipolation memoization is essentially always impure. For it to be used in a pure functional language, it generally requires language level support.

    • @Cookipolation
      @Cookipolation 2 ปีที่แล้ว

      @@brendanhansknecht4650 exactly

    • @brendanhansknecht4650
      @brendanhansknecht4650 2 ปีที่แล้ว +4

      That doesn't add any value to comment on. All pure languages eventually compile to impure constructs. Modern hardware is innately impure.

  • @theazharul
    @theazharul 2 ปีที่แล้ว +1

    Is it safe to use Elm as it is not stable yet?

    • @razzeeee
      @razzeeee 2 ปีที่แล้ว +11

      It is, the version number doesn't reflect it. But at this point it hasn't changed significantly for some years and won't according to the author.

    • @pipi3105
      @pipi3105 2 ปีที่แล้ว +9

      It's the most stable language I know and a delight to work on. You'll love yourself for chosing Elm today in 10 years when you'll want/need to refactor your app. The fact that it hasn't had an update in 3 years is just how stable it is. There have been no updates, because the language just doesn't need it.

  • @humble_integrity
    @humble_integrity ปีที่แล้ว

    it depends on what you do... try doing woodworking with a screw driver

  • @jartownboy
    @jartownboy 2 ปีที่แล้ว +1

    Nice

  • @ferroalloys594
    @ferroalloys594 หลายเดือนก่อน

    Errr.. FUNCTIONS ABSTRACT OVER EXPRESSIONS. End of briefest possible explantion! Simples... (:-)

  • @tamask
    @tamask 2 ปีที่แล้ว +2

    Cool, but then how to write to or read from a database? These principles work as long as your code is isolated from the outside world, but such code is useless. How to use this style for real world applications where database access is required too?

    • @terragame5836
      @terragame5836 ปีที่แล้ว +1

      I believe the "IO monad" is what is used for overall side effects of the program in pure FP. Essentially, your main function gets an instance of this IO monad and must return it at the end. Every impure operation is then modeled as a function that takes it as one of its arguments and return its replacement at the end. Essentially, it represents the state of the universe. An impure operation consumes it, and returns the new state, which is different, so using the returned value again cannot just use the previous cached result. All sorts of input-output tasks, including database interactions, must thus be implemented over the IO monad in a pure functional language

  • @JameyKirby
    @JameyKirby 2 ปีที่แล้ว

    const int global1;

  • @ikbo
    @ikbo 2 ปีที่แล้ว

    What's up with Elm? Is it dead?

    • @MeNumber47
      @MeNumber47 2 ปีที่แล้ว +1

      More Stable than ever. Still widely used. Give it shot if you get a chance. The more time you put into it, the more it gives back

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 2 ปีที่แล้ว +1

    It is too bad, no way to generate a unique id using a pure function.

    •  2 ปีที่แล้ว +5

      Incorrect. You could, e.g. make the seed of the PRNG a parameter to the generator-function.

    • @TankorSmash
      @TankorSmash 2 ปีที่แล้ว +4

      The way RNG is used in pure langs is you pass a seed in and get the result and new seed to use next time back.

    • @kamertonaudiophileplayer847
      @kamertonaudiophileplayer847 2 ปีที่แล้ว

      @ So a pure function can return a different result for the same request parameter, you need somehow to deliver that to not very smart viewers.

    • @brendanhansknecht4650
      @brendanhansknecht4650 2 ปีที่แล้ว +4

      @@kamertonaudiophileplayer847 it just takes an extra loop of tasks. First run a task to get the seed(time or whatever) from that point on, anything that needs randomness just depends on that initial input and what is derived from it. So it is pure, but an input is random, leading to random outputs.

    • @TankorSmash
      @TankorSmash 2 ปีที่แล้ว +3

      @@kamertonaudiophileplayer847 the same seed will always return the same value in a pure language.

  • @bartonhankle9484
    @bartonhankle9484 4 หลายเดือนก่อน

    What’s the hurry? Please talk slower. I quit watching because it makes me uneasy.

  • @anasouardini
    @anasouardini ปีที่แล้ว

    Even the title is FALSE: pragmatic programmer would rather use a combination of tools not just FP. There is no such program that would prefer to be written in one paradigm.

    • @VeejayRampay
      @VeejayRampay 11 หลายเดือนก่อน +3

      chill

    • @anasouardini
      @anasouardini 11 หลายเดือนก่อน

      @@VeejayRampay aight, aight.

    • @Nellak2011
      @Nellak2011 10 หลายเดือนก่อน +1

      Richard Feldman even admits that FP is not appropriate for all domains. He said that FP is good when you are far away from bare metal and you are't super concerned with performance (unless you use Roc or some other high performance FP).
      He said that if you do low level, then it is more fitting to be imperative because the CPU is super imperative.
      So no, you don't know what the fuck you are talking about with your comment. Actually watch Richard Feldman's videos before spewing this toxicity.

    • @anasouardini
      @anasouardini 10 หลายเดือนก่อน

      @@Nellak2011
      Content: fine
      Title: wrong; clickbaity
      capiche!

    • @coldsteel9420
      @coldsteel9420 10 หลายเดือนก่อน +2

      That makes as much sense as saying that a pragmatic programmer would sometimes prefer Assembly.

  • @mrCetus
    @mrCetus 2 ปีที่แล้ว +5

    Great video and speech! Thank you Richard.