Stay with C# or switch to F#? Let's fight! Let's vote! - Vagif Abilov & Max Arshinov

Sdílet
Vložit
  • čas přidán 22. 08. 2024
  • This talk was recorded at NDC London in London, England. #ndclondon #ndcconferences #developer #softwaredeveloper
    Attend the next NDC conference near you:
    ndcconferences...
    ndclondon.com/
    Subscribe to our CZcams channel and learn every day:
    / ‪@NDC‬
    Follow our Social Media!
    / ndcconferences
    / ndc_conferences
    / ndc_conferences
    #dotnet #csharp #fsharp #functionalprogramming
    We are two developers with a long experience in OOP, and in the .NET world it means C#. Both of us later discovered functional programming, and in the .NET world it means F#. One of us was convinced to make a switch to F# with its immutable data and terse syntax and never looked back. The other one was convinced that the evolution of C# and adoption of FP elements make it a solid language to take advantages of both paradigms. Perhaps both of us are right in our choices but what would YOU do?
    Come to our session, and you will become our judge. You will be presented a series of small tasks with solutions in both languages, and you will vote for a winner in each category. Perhaps yo can make a choice for your own future?

Komentáře • 43

  • @striker865
    @striker865 Před 3 měsíci +19

    F# is so concise and pleasant to work with

  • @AvenDonn
    @AvenDonn Před 3 měsíci +16

    I can't believe they managed to get all 5 F# developers to attend the same talk

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

      😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂.
      You guys kill me.

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

      FIA! There are SIX of us!

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

      @@Gr3gB311 whats the full meaning of FIA?

  • @WillEhrendreich
    @WillEhrendreich Před 3 měsíci +8

    How have you guys not talked about the best part of fsharp? TYPE INFERENCE. seriously. I'd take Hindly Milner type inference over almost any feature. not having to babysit the compiler is the most amazing speed multiplier in code.

    • @WillEhrendreich
      @WillEhrendreich Před 3 měsíci +2

      this is also an objectively superior feature, it's a land slide victory in fsharp's favor, csharp has nothing to answer it.

    • @maxarshinov
      @maxarshinov Před 3 měsíci

      We had to cut it out because of the time constraints;)

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

      @@maxarshinov gotta pick which seem like the most useful issues to bring up, I understand. I just think it might be more of a win than most people realize, and is the thing that I miss most when I use csharp. The ability to let the compiler do the mental gymnastics of figuring out how to make the function signatures fit together is incredibly helpful for composability. Csharp's compiler doesn't help you make composition easier, it's a pedantic "uhm ackshually" jerk that will refuse to do anything until you've got it's magic secret code words spelled out and pronounced correctly. It will gladly tell you you're wrong, though not exhaustively check everything you'd like. It will tell you you're not passing the right thing around but it's up to you to figure out what will make it happy, when in the same situations it's clear to fsharp's compiler what you wanted from the beginning, and like a true pal, just says, "alright, I see what you're getting at, let me just adjust this automatically for you, make sure things are good to go and safe under the hood, you just keep exploring the actual problem you set out to solve, I'll do the drudgery for you. I'm a computer after all, that's what I'm good for. "

    • @aguluman
      @aguluman Před 3 měsíci

      ​@@WillEhrendreichHi Will.

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

      @@aguluman haha hey man!

  • @carlosleyva-calistenia6400
    @carlosleyva-calistenia6400 Před 3 měsíci +4

    I have found only one reason to use C# over F# and that's the lack of partial class support.
    Yes, I'm aware about type extensions and whatnot and I like them way better, but some fringe cases really require partial classes for some technical reasons I forgot (like Godot 4.x).
    Other than that, everything that can be done in C# can be done in F#, but it's way easier to reason about and there's less noise distracting me from the things that actually matters: the algorithms.

    • @aguluman
      @aguluman Před 3 měsíci

      Thanks for the feedback. The community appreciates it.

  • @TheUArabej
    @TheUArabej Před 3 měsíci +8

    Funcional bros - stand up

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

    C# adopting features from F#/FP is not going to turn it into a language that can compete with F#, unless it is somehow morphed into F# in time. That, obviously, makes no sense when we already have F#. If you are a C# developer that wonders whether F# is worth the bother - just try it. If you don't like the boost in productivity, the increased quality, the reduced verbosity and complexity, the improved architecture, the power, and the pure joy of not wasting time... well, fair enough. At least you have plenty of work.

  • @robhunt8378
    @robhunt8378 Před 3 měsíci +2

    When you have to rely on heavy mutability => C#
    For pretty much everything else, F# is what Microsoft wishes C# could be.

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

    - Data vs Operations - I'm surprised extension methods and Extensions weren't brought up in any way. I think the vote for this versus Discriminated Unions nicely aligns with the priorities Microsoft sets for itself - we should get the first taste of extensions before DUs and hopefully be able to move even more stuff away from plain data types in C#;
    - Polymorphism vs Pattern Matching - I think this is poorly phrased, mashed together two different things. You will do PM or switching either way somewhere. (1) Polymorphism can be compared to Encapsulation. (2) Exhaustive check can be achieved in different ways. Classes in C# can be closed for inheritance but there is not enough language support to make full use of it. Pattern matching is a growing part of C# as well, it's just that we have to keep the "otherwise" case.

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

    Really??? People is afraid of computation expressions? Unfortunate

  • @KarenTazayan
    @KarenTazayan Před 3 měsíci

    Interesting, thank you!

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

    Which language would you coose?
    a: C++
    b: C#
    c: Java
    d: JavaScript
    e: Python
    I would choose f: Like F#

  • @chewbaccarampage
    @chewbaccarampage Před 3 měsíci +2

    If you're considering FP, I would recommend Richard Feldman's 2021 talk called Functional Programming for Pragmatists over this talk. These OOP vs. FP talks aren't very helpful because they don't address the software qualities that each tool (i.e. programming language) produces over time. It's like arguing that a sledge hammer is better than a ball peen hammer. They both are useful under certain situations.

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

      Just downloaded it will watch soon.

  • @slyredbeard
    @slyredbeard Před 3 měsíci

    What was the exception handling library that Max mentioned?

    • @talwald1680
      @talwald1680 Před 3 měsíci

      Polly - only for http error handling

    • @slyredbeard
      @slyredbeard Před 3 měsíci +2

      @@talwald1680 Ah, i know that one ). Thank you very much!

    • @anreton
      @anreton Před 3 měsíci

      ​@@talwald1680Polly not only http error, btw

  • @thomasbittner1009
    @thomasbittner1009 Před 3 měsíci +2

    I'm almost afraid to bring this up, but here it goes:
    For me, the biggest disadvantage of F# is that it forces me to use spaces for indention. I don't want to start a tabs vs. spaces flame war here, but at least, I'd like to have the choice. Especially for visually impaired developers, this is a game changer, and forcing spaces for indention borders on discrimination.
    (Yes, I know there is an option in F# to use tabs if you really want to, but it comes with so much baggage that it's almost unusable.)

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

      I use to hate this, but then we use to struggle to get the team to be consistent with C#. Even with a .editconfig, the team had to manually structure the code in order to get consistency, but over time things would end up inconsistent.
      F#, although a bit heavy-handed, forced the team to use a consistent style. We don't think about it anymore and the code is guaranteed to be formatted consistently otherwise the compiler will bark at you. The biggest feature of only being able to call code defined above has been amazing. We spend more time solving the problem at hand and less time on formatting consistency.
      I use to unfairly argue that the team wasn't discipline, but it's human nature to do the "fast" thing and so entropy will eventually take over, but having the compiler force you in one direction, is like a big stick that forces you to be discipline.

    • @aguluman
      @aguluman Před 3 měsíci

      Do you all get employed as C# devs and turn to F# devs or you are all employed as F# devs from the get go?

    • @aguluman
      @aguluman Před 3 měsíci

      ​@@chewbaccarampageI love your comment.

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

      @@aguluman C# dev shop, but had support from leadership to switch to F# after making a business case for it. Mutability was abused too much and state management bugs became an issue, so basically suggested we remove mutability too see how it would go. After a year, things have improved dramatically, but on-boarding is a big challenge. Getting the team to use data and composition has been a mental shift over mutable objects.

    • @aguluman
      @aguluman Před 3 měsíci

      @@chewbaccarampage Can I join your team. Pretty Please. I know how to think, when using F#.

  • @diegoX6Turbo
    @diegoX6Turbo Před 3 měsíci +5

    C# rules forever

    • @TheStickofWar
      @TheStickofWar Před 3 měsíci +6

      It’s weird to even compare. An OOP language with a syntax that everyone can be easily comfortable with. And F#, a functional language which is great for domain modelling and well.. functional programming.
      I would use both.

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

      @@TheStickofWar C# is a multipurpose and multi-domain programming language, with a great blend of OOP and FP capabilities. C# is also fantastic for domain modelling. What the authors were trying to do is just sell f#, instead of focusing on educating upcoming programmers. lol

    • @KurtMueller
      @KurtMueller Před 3 měsíci +2

      @@TheStickofWar you can call any c# code from f# and even define classes and use inheritance in f#.

    • @WillEhrendreich
      @WillEhrendreich Před 3 měsíci +2

      Have you written non-trivial software in fsharp?
      Have you talked to people who have written in a good amount of both, and asked them which they prefer?
      Honestly I have asked this question a lot, and I've heard of only 1 person who someone from twitter knew from working with him in the past, who genuinely preferred csharp after writing fsharp.
      Why did he prefer it?
      Because he liked a more verbose language.
      That was it, that was his self reported selling point, that in the grand scheme of things he liked writing more code to do the same thing...
      in which case, sure.. yep.. in that exact instance, csharp surely wins.
      However, as far as literally everyone else I've talked to who has done both in earnest, fsharp is named to be the clear winner, in their mind.
      Don't knock it till you tried it.