The functional journey of C# - Mads Torgersen - NDC Copenhagen 2022

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

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

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

    i love the fact that mads (who, lets not forget is a C# language designer) said "a bunch of people claim they understand Monads but in reality most don't and if you do understand it, its not for long" Then he says he has understood it many times and then the next day was like "what was it about again?" - How awesome and humbling to hear.

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

      Yes. Absolutely. A frank and encouraging statement.

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

      I fail to see what the confusion is. A Monad is just a monoid in the category of endofunctors. This is so well easily, simply stated. Easily stated.

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

      @@jewulo Nice. Thats worth an upvote!

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

      @@jewulo ikr!!!

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

      I'm pretty sure that Mads knows exactly what they are and this was slightly tongue in cheek :-) But yes, there's a lot of confusion about them (and the misunderstanding that you need to know what they are to "do" FP).

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

    Coming from a functional background, this talk did a lot to improve my understanding of c sharp. Related it back to what I know and pointed out a bunch of equivalences that I had missed. I don't think I'll ever be a very good c sharp coder but at least it showed me how to read the language. I can relate to having "understood monads many times" lol. Really enjoyed the presentation :)

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

    Compiler language features vs. runtime language features would be a nice thing to have control over.
    You either set your lang version above what your runtime supports and you have to keep track of runtime features and not use them or you keep it current and can't use any new syntax sugar.
    Unless this already exists and I've never been able to find it 🙃

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

    This is nice but I just wish F# was more popular and accepted. I am doing debugging on an objected oriented codebase I was not involved with building that has mutable global objects injected all over the place and it's just a nightmare.

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

      A typical shit-codebase. I try to avoid them or charge more for it.

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

      When I close my eyes, I see parameterless void methods doing internal mutation.
      The spaghetti becomes so unbearable, that it makes you wish things were declared explicitly mutable or immutable.
      But then there are functional patterns to save us, along with Rust for those who like it.

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

    I wish the csharp language team would tackle the null clusterfuck with more effort. The nullable reference types are a neat compiler feature but produces just warnings and enforces nothing.
    Maybe give us code contracts for method signatures. Like "this param cannot be null" or "this integer must be between 0 and 100" or "will throw this exception when this condition is met".
    XML documentation is nice (if existing at all) but having a compiler that enforces and safeguards APIs would be way better. Remember ".NET Code Contracts" from Microsoft Research? Pepperidge Farm remembers.

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

      Pepperidge Farm remembers?

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

      @@rolf8064 a meme

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

      It enforces code to give better intent and meaning

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

      You are very correct. I tried it a bit. Noticed that it doesn't enforce anything. Then I completely disabled it. It would be very very nice if it was a very strict system.

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

      @dasunguy @XtroTheArctic "just warnings" by default. Toss something like dotnet_diagnostic+CS8629+severity = error into an editorconfig and voila, enforcement. (Replacing '+' with period). CS8618 and CS8602 are other relevant ids you may see. Fine-grained control (silent/suggestion/warning/error) is possible, no need for a blanket "all warnings as errors" Edit: Or via VS UI, click lightbulb => Suppress or Configure Issues => Configure Severity ... writes it to editorconfig

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

    Thanks! I really enjoyed this presentation! I'm from the Java world (it's what pays the bills) however in my soul I'd like to work in the C# world

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

    Only thing i want in my life is discriminated unions in c#😂

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

      Yes, please!

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

      I have been dreaming for Discriminated Union

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

      @@obinnaokafor6252 Every year i think the next C# version will surely have but it never does.

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

      @@zhh174 They are trying to get some other features out be proceed with DU - as DU would be built on top of them. Hopefully it would be done sooner rather than later

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

      Type classes and higher kinded types for ever.

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

    Thank you so much for uploading this talk, it is invaluable for me

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

    I am lookin at Zoran Horvat's course on Pluralsight in C# 10 and it seems like records (and record structs) in C# 9 are another important building block in making C# a bit easier to use with functional programming style.

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

    I'm glad Microsoft quickly walked back the C# changes made for complaining VB and C++ programmers. Lead to a much better language.

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

    Brilliant :-)

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

    "When it comes to cloud programming, history is on the side of functional programming. I'm sorry. OOP is not made for that"
    Man... that hurts.

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

    Is it possible for Anders Hejlsberg to come back and lead the development of c#?

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

      Why?

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

      @@kooraiber I believe he was the original leader of the team that developed C#. Before that, he worked for Borland and was the leader of the team that developed Delphi.

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

    Fucking amazing :D

  • @17plus9
    @17plus9 2 ปีที่แล้ว +23

    Just use F#.

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

      The best part about csharp becoming more functional is that people's minds will be more open to Fsharp lol. I made the switch this last year and I am so unbelievably happy it's unreal.

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

      F# is surprisingly more verbose in some cases - anonymous functions and Seq stuff in particular. Method based linq in C# is just better.

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

      Or both. Put your domain in your f# projects and your infrastructure in your c# projects.

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

      @@gdargdar91 I've had to do this, actually. Efcore doesn't always work as well with fsharp.

    • @17plus9
      @17plus9 2 ปีที่แล้ว

      @@gdargdar91 Yeah, I use exactly the approach you've described.

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

    how are you?- dear~Wow! really breathtaking footage~:)

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

    Come on guys its 2022, these presentations have to get above Hello World level....

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

      well you know they can never come up with anreal world example that suit their narrative

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

      They have to fit their content into an hour. It's your job to dig deeper.

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

      @@michaelsutherland5848 The dress is red because paper and screwdriver. Its your job to paint the ceiling.

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

      @@chrise202 It's free content. Don't blame them that you're too lazy to learn it.

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

      @@michaelsutherland5848 Lazy to learn what? Hello World? U ok?

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

    most of the code here is just a complete mess