Stay with C# or switch to F#? Let's fight! Let's vote! - Vagif Abilov & Max Arshinov
Вставка
- Опубліковано 12 тра 2024
- This talk was recorded at NDC London in London, England. #ndclondon #ndcconferences #developer #softwaredeveloper
Attend the next NDC conference near you:
ndcconferences.com
ndclondon.com/
Subscribe to our UA-cam 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? - Наука та технологія
F# is so concise and pleasant to work with
I can't believe they managed to get all 5 F# developers to attend the same talk
😂😂😂😂😂😂😂😂😂😂😂😂😂😂😂.
You guys kill me.
Funcional bros - stand up
We up.
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.
Thanks for the feedback. The community appreciates it.
When you have to rely on heavy mutability => C#
For pretty much everything else, F# is what Microsoft wishes C# could be.
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.
this is also an objectively superior feature, it's a land slide victory in fsharp's favor, csharp has nothing to answer it.
We had to cut it out because of the time constraints;)
@@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. "
@@WillEhrendreichHi Will.
@@aguluman haha hey man!
Interesting, thank you!
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.
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.
Just downloaded it will watch soon.
What was the exception handling library that Max mentioned?
Polly - only for http error handling
@@talwald1680 Ah, i know that one ). Thank you very much!
@@talwald1680Polly not only http error, btw
Really??? People is afraid of computation expressions? Unfortunate
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.)
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.
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?
@@chewbaccarampageI love your comment.
@@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.
@@chewbaccarampage Can I join your team. Pretty Please. I know how to think, when using F#.
C# rules forever
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.
@@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
@@TheStickofWar you can call any c# code from f# and even define classes and use inheritance in f#.
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.