Currying for More Generalized Angular Code

Поделиться
HTML-код
  • Опубликовано: 25 авг 2024
  • НаукаНаука

Комментарии • 58

  • @kylerjohnson988
    @kylerjohnson988 27 дней назад +1

    I've generally made a mess of teaching this topic... This is the best way I've ever seen it explained and I will likely be referring folks this video from now on.
    Deborah, you have such a talent for explaining things in a digestible way. Right after I landed a dev job in a .NET shop in 2016, I found your article "Practical Uses of Lambdas" in an old CODE magazine from 2010 they had at the office and I've been following your content ever since. Your C# content really helped me thrive there. Such superb content for a long time. It's really cool to see your content do the same for the Angular community.

    • @deborah_kurata
      @deborah_kurata  27 дней назад +1

      Thank you so much for the kind words! Glad to hear the video was useful.
      And it's amazing that you found an old CODE magazine! Good to hear that was useful as well! (Unlike Angular, C# hasn't changed that much in these past 20+ years. LOL)
      All the best. 😊

  • @Matrium0
    @Matrium0 Месяц назад +13

    Great video, very well explained!
    Not gonna lie, I'm not a fan of currying personally. In Typescript it does feel like an unfavorable trade off: You WIN a small reduction of trivial boilerplate but you LOOSE a lot of clarity and readability.
    Maybe I am just too untrained on the pattern, but right now I feel like I need AT LEAST 10 time as much time to comprehend a method with currying in comparison to a "normal" method.
    Maybe this dwindles a bit with more experience in writing/reading curry'd methods?

    • @deborah_kurata
      @deborah_kurata  Месяц назад +1

      Thanks!
      And yes, readability/understandability is important, especially when working on a team.
      I'm seeing this as something more useful for those building their own framework or set of tools for their team. If a company wants to build their own NgRx types of tools, for example, they may need something like this. Also, I hadn't seen this technique until recently, so thought it would be good to share. 😊

  • @Tryste
    @Tryste Месяц назад +6

    Great explanations as usual thank you a lot

  • @Ali-cx7sy
    @Ali-cx7sy Месяц назад

    Great stuff, Deborah, thank you very much!

  • @rkumar.lnct24
    @rkumar.lnct24 Месяц назад +2

    Thanks 🙏. Whenever I write code the only thing in my mind is to follow DRY as it leads to implement different patterns. I was thinking of learning currying practically and here your video came. Last 2 videos are for coders who want to write optimized code...Very well articulated video...thanks

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Thank you so much for your kind words. Glad to hear that they are useful!

  • @jonathancastells243
    @jonathancastells243 Месяц назад

    I really enjoy your content, thanks for sharing, love your easy to understand explanations 😁

  • @jesusdelarua5995
    @jesusdelarua5995 Месяц назад +1

    Great video Deborah!
    Like it a lot.
    In every video of yours, I learn something new. Same thing can be said about your Pluralsight courses.
    I really appreciate it.
    Thank you very much!

    • @deborah_kurata
      @deborah_kurata  Месяц назад +1

      That is wonderful to hear. So glad the videos are useful. Thank you!

    • @jesusdelarua5995
      @jesusdelarua5995 Месяц назад +1

      @@deborah_kurata Thank you Deborah!

  • @abdulrenishr
    @abdulrenishr Месяц назад

    Great. Awesome presenting

  • @metric152
    @metric152 Месяц назад

    I wish I had this video back in 2002 to explain what curry is. I’m familiar with it from having worked in c and c++ but never quite understood it from a very dry academic perspective. I’ll have to keep an eye out in my code for when I’m passing in the same argument over and over again and try and use this technique.

    • @deborah_kurata
      @deborah_kurata  Месяц назад +1

      It's one of those things that you may not use often, but is useful when you do need it. 😊 Thank you!

  • @elyoaprogrammer
    @elyoaprogrammer Месяц назад

    Excellent!! One more tool added to the box. Thanks

  • @cverde1234
    @cverde1234 Месяц назад

    In C#, it's pretty easy to define a custom Curry delegate like:
    delegate Func Curry(T1 arg1);
    It's not common but can definitely be done.

    • @cverde1234
      @cverde1234 Месяц назад

      To avoid nasty Func

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Yep. I didn't mean to imply it couldn't be done. Currying is just redefining functions after all. My point was that currying isn't something you normally learn (or even hear about) in languages such as C#.

  • @janis666
    @janis666 Месяц назад

    another awesome tutorial! I tried to understand that watiching some other videos but here I finally got that! Thank you :)

  • @enverusta7811
    @enverusta7811 18 дней назад

    Great job! Although i believe it is not readable, it is still good to know!

    • @deborah_kurata
      @deborah_kurata  11 дней назад

      Thank you. And yes, the more generalized the code the more difficult it is to read. That's why many of these techniques are only used when creating function libraries/frameworks that can be used without needing to know their details.

  • @ianokay
    @ianokay Месяц назад

    So in this case, obviously because we're using Javascript, I would just use call() or bind() for creating a function with a hard first argument. Are these just native currying functions in JS, so you don't have to complicate your code syntax writing your own nested functions everywhere you need to use this?

  • @cooleboy50
    @cooleboy50 Месяц назад

    Great video once again Deborah! One stupid question though, why do you create a new array each time in the first example instead of using push(). Arrays are passed by reference right, so that would also take away the reassignment issue?

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Thank you! And there's no such thing as a stupid question. 😄
      Yes! Using push() would get rid of the reassignment issue. But then we wouldn't be following immutability principles (which are important now that we are using signals). For my simple case, yes, I could have used push and minimized the additional repeated code.

  • @musoverda
    @musoverda Месяц назад

    great as always!

  • @ashishmaurya3669
    @ashishmaurya3669 Месяц назад +1

    Hi, I am new to angular. Currently I am going through your pluralsight "angular getting started" course. However it is not updated with angular 18. So, should I go through course? Also, are you planning to update it to latest?

    • @HenrikBgelundLavstsen
      @HenrikBgelundLavstsen Месяц назад

      its fine to learn older versions. Lots of the basics stay the same, just a few newer features added.

    • @deborah_kurata
      @deborah_kurata  Месяц назад +2

      Welcome to the Angular family!
      Sadly, Pluralsight won't allow me to update the course. 😞
      You can watch the course if you are interested in understanding the basics of how Angular works. But don't bother with "coding along" as there are lots of little things that no longer work. You could also watch `Angular Fundamentals`, but that is also several versions behind at this point.
      If you watch the course for the basics, you could learn about many of the new features by watching my RUclips videos.
      Here is the playlist of new Angular topics such as standalone components, and the new template syntax: ruclips.net/p/PLErOmyzRKOCrzJ9zUEGgC1zVzVGt3hMmV&si=vvgz5cfGoHMxIYol
      And here is a playlist of the new Angular signals: ruclips.net/p/PLErOmyzRKOCr07Kcnx75Aqh6PWSbIokPB&si=UjmaSe4J7CK2B7Cw

    • @ashishmaurya3669
      @ashishmaurya3669 Месяц назад +1

      Thank ​@HenrikBgelundLavstsen for clarification. I am in midway of the course and to be honest she is best, her teaching style. Everything going in mind smoothly.

    • @ashishmaurya3669
      @ashishmaurya3669 Месяц назад +1

      Thanks @@deborah_kurata for clarification.

  • @kishoreandra
    @kishoreandra Месяц назад

    I guess this is the only video I understood the real purpose of currying... But still wouldn't write it myself 😅

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Yeah, this seems like something that would mostly be used by library authors. But it's good to understand what it is. 😊

    • @kishoreandra
      @kishoreandra Месяц назад +1

      @@deborah_kurata for sure 💯

  • @ralfkretzschmar8131
    @ralfkretzschmar8131 Месяц назад

    Again a good one! Thanks for doing these vids.
    I always admire that you avoid any shortcuts while explaining something.
    Somehow related to the topic of the video (functions as objects): I started to add pre-configured functions (or curried functions) to my Observables. Then the template just needs to call a method that is part of the data. If it is bound to a button, if the funcition is null, the button is disabled. So - for example - a list of snacks has not only a property for the name but also for a function (without parameters) that will delete exactly that snack.
    I would be interested what you think of that approach.

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Great to hear they are useful.
      I'm not sure I am100% follow what you are suggesting. Can you do a stackblitz with an example?
      (The comments appear to block any links from anyone by me, so you may have to add spaces to a stackblitz link to include it in a comment.)

    • @ralfkretzschmar8131
      @ralfkretzschmar8131 Месяц назад

      @@deborah_kurata angular-paging-api-deborahk-qz6c18

    • @ralfkretzschmar8131
      @ralfkretzschmar8131 Месяц назад

      @@deborah_kurata Hi, i have no luck with answering here. Whenever I include a link - even an obscured one - my message gets deleted.

    • @ralfkretzschmar8131
      @ralfkretzschmar8131 Месяц назад

      I am not sure if you can see all the forks of your projects on stackblitz. But I have forked your Angular Paging API project and made some changes there.

    • @ralfkretzschmar8131
      @ralfkretzschmar8131 Месяц назад

      Maybe the id of the fork will help. It is qz6c18

  • @tiberseptim7183
    @tiberseptim7183 Месяц назад

    Good thing about currying - you never gonna need it, if you are not working with lambda calculations

    • @deborah_kurata
      @deborah_kurata  Месяц назад

      Could you elaborate on that? I'm not sure I follow.

    • @tiberseptim7183
      @tiberseptim7183 Месяц назад

      @@deborah_kurata I meant, that you don't need currying for frontend. There is always a simpler solution that complies with DRY, even in your artificial example.

    • @deborah_kurata
      @deborah_kurata  Месяц назад +2

      @@tiberseptim7183 Got it. I agree that most front end developers would not need currying.
      I think it would primarily be used by anyone building a library or framework. For example, a company wants to build its own state management library for use by its Angular developers.