Monoid Design Pattern (C#)

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • Explanation of the Monoids concept in C#. Monoid is combination of things to build bigger things. The mechanism in which objects/functions/values get combined is up to the Monoid implementation.
    Patreon 🤝 / raw_coding
    Courses 📚 learning.raw-c...
    Shop 🛒 shop.raw-codin...
    Discord 💬 / discord
    Twitter 📣 / anton_t0shik
    Twitch 🎥 / raw_coding
    Playlist: • c# design patterns
    Source: github.com/raw...
    #csharp #monoid #designpatterns

Komentáře • 25

  • @quantum634
    @quantum634 Před 2 lety +2

    I dont see how this is useable when writing code hmmm 😑
    A real example would have been cool

    • @RawCoding
      @RawCoding  Před 2 lety +3

      agree, the time to write up a good example takes more time than explaining the concept. Maybe one day you'll discover this pattern in your work. Here's a good example in haskell czcams.com/video/BovTQeDK7XI/video.html he basically concatenates (adds) a list of predicates which in turn returns a predicate, so the example I showed is how to combine any functions together in haskell you get out of the box tools to glue functions together. But basically he creates a single predicate out of many predicates and that serves as text filtering. the point about the avarage javascript code is the fact that boolean conditions written like that require a code change to update, when you work against an array of functions that's a swing in the direction of depending on data and being able to update things dynamically rather than having to do code changes.

    • @pmcgee003
      @pmcgee003 Před 2 měsíci

      There is an awesome talk by Ben Deane. Monoids are literally everywhere. DB updates, string concatenation, integer addition, vector addition, multiple INI files, ...
      czcams.com/video/INnattuluiM/video.html

  • @J-Kimble
    @J-Kimble Před 3 lety +1

    Yes!! Just learning about monoids in functional programming.

  • @g3ff01
    @g3ff01 Před 3 měsíci +1

    The first part of the video was nice and clear, but the second part was confusing and hard to follow. The first confusing thing for me, was that I though that "int Add5(int a) => a + 5;" was itself a mondoid with the set of integers, while it is not, as it is not even a binary operation. Then for the second watch it started to become clearer that the monoid here would be the general concept of combining integer binary operations or something like that. However, that was a bit too much for 1 video in my opinion. There was a lot of not so used syntax and stuff used for a regular (OO) C# programmer (Func, generics, operator overloading, lambda expressions used to combine functions + the whole new mathematical concept... It was a bit too much for me (and I am not even a junior programmer, at least I don't consider myself as one already).

  • @dudu2891
    @dudu2891 Před rokem +1

    This video is gold

  • @dkorobov
    @dkorobov Před 3 lety +1

    This might be a good extension for the middleware where some function could be a sum of functions for “parallel” execution.

  • @FXK23
    @FXK23 Před 2 lety +1

    Thanks so much that was great, just coding along makes it easier to understand. Would be nice, If we could select '.' as composition operator in c#

    • @RawCoding
      @RawCoding  Před 2 lety

      Ye operator overloading in c# is not very flexible

  • @viktorhh
    @viktorhh Před 3 lety +1

    I would love to see a continuation to this series, with patterns displaying how you can implement custom map, bind, return, apply, with relevant examples. Any such plans? Thanks!

    • @RawCoding
      @RawCoding  Před 3 lety +1

      That’s up next, unfortunately no operator overloading for that

    • @viktorhh
      @viktorhh Před 3 lety +1

      @@RawCoding So I've watched your Monad Pattern video now, great introduction! Would love to see more concrete examples on the subject since it's unavoidably abstract in nature. Any thoughts on continuing the FP track, perhaps just the basics?
      Also, you missed an easy win in this Monoid Pattern video: using Linqs Aggregate() which takes a monoidal operation. You could have made a list of your Function, and then Aggregate.
      Anyways, please keep the great content coming!
      I also have a final wish/request in case you take those.. compound patterns. I.e. examples of many design patterns used together, would be greatly appreciated!
      Thanks 😁

    • @RawCoding
      @RawCoding  Před 3 lety +1

      Thanks yeah the aggregate would be cool to show I just didn’t want to deviate from the idea. I can cover compound patterns but generally if you look at frameworks you’ll find them there.

  • @mariomorazan9473
    @mariomorazan9473 Před 3 lety +1

    Love your videos man!!!!!!!!!

  • @sunnypatel1045
    @sunnypatel1045 Před 3 lety +1

    My guy!!! Will you be doing more functional programming tutorials? Or maybe doing a video on building another restful app maybe with a cloud service like azure?

    • @RawCoding
      @RawCoding  Před 3 lety +2

      I want to do Clojure tutorials at some point in the future

    • @cocoscacao6102
      @cocoscacao6102 Před 3 lety +2

      @@RawCoding Why not an F# video? This video really surprised me :)

    • @RawCoding
      @RawCoding  Před 3 lety

      Because I don’t know f# and Clojure had one of the biggest impacts on my skills

    • @cocoscacao6102
      @cocoscacao6102 Před 3 lety

      @@RawCoding Fair enough. Wrong assumption since your videos are .Net realm... Keep on with interesting content. Functional subjects are rare

    • @sunnypatel1045
      @sunnypatel1045 Před 3 lety

      @@RawCoding Agree tbh F# is more functional and C# is currently adopting it. Clojure is too one of many skills I need to understand. Looking forward to your videos dude and keep up the good work!

  • @nyendwa
    @nyendwa Před rokem

    The link to your discoord channel is broken