Functional Programming in C#

  Рет қаралды 20,876

dotnetsheff

dotnetsheff

Күн бұрын

Пікірлер: 51
@FXK23
@FXK23 4 жыл бұрын
Great talk. Missing the Zoran Horvat courses on pluralsight in your 'Further reading' section.
@madsimonj
@madsimonj 3 жыл бұрын
I'm afraid I don't have a pluralsight subscription. Please feel free to share the link, though.
@MartinHAndersen
@MartinHAndersen 2 жыл бұрын
The nino validation returns true or false. How could it return and explanation on why it failed?
@pino6782
@pino6782 3 жыл бұрын
Just in case people have not noticed yet, .Net has also native, functional-first programming language called F#.
@madsimonj
@madsimonj 3 жыл бұрын
It absolutely does. I've never learned it myself, but I'd be happy to if I were in a team that was up for it. Sadly I still think we're a long way away from mainstream support for F#, so there's nothing wrong with trying to make use of those same principles in C# itself.
@ProgrammingMadeEZ
@ProgrammingMadeEZ 4 жыл бұрын
Pattern matching in C# 8 is much improved since this video was released.
@madsimonj
@madsimonj 3 жыл бұрын
Very true. I'd also strongly recommend looking at the new Record types in C#9. They're one of the best functional features in a while
@drunkonmonads
@drunkonmonads 3 жыл бұрын
I have used language extensions which encapsulates the ideas mentioned here so no need to write own version. Great talk.
@madsimonj
@madsimonj 3 жыл бұрын
I agree. No need, but its a good learning exercise & I think the syntax can be cleaner sometimes when you roll your own compared to LanguageExt
@smritidutta1631
@smritidutta1631 3 жыл бұрын
Codes are not fully visible ,which hinders my understanding.
@simonpainter2242
@simonpainter2242 2 жыл бұрын
Apologies for that. I've done this same talk for a number of other venues. The code is probably easier to read on some of those. If you check out the NDC Conferences channel, you'll find an updated version of this I did for NDC Porto earlier this year
@eonduplessis11
@eonduplessis11 4 жыл бұрын
I found this workshop handy. Although, I code in Typescript now. I have done .NET / C# for 8 years. Maybe I can find some use for this in the game development space. There is a UI/User interaction, but I suppose that's where I'd do plain old OO, and where we process gamedata and models, rather use Pure functions where possible.
@chesterapavliashvili1533
@chesterapavliashvili1533 4 жыл бұрын
I am trying to apply functional C# in unity engine too
@SamuelLugoBueno
@SamuelLugoBueno 4 жыл бұрын
Can You please share the slides? This is super handy! Thanks for the useful video!
@madsimonj
@madsimonj 4 жыл бұрын
Thanks! I've just popped a link to the slides up
@hirisraharjo
@hirisraharjo 3 жыл бұрын
@@madsimonj I have a question, until now I thought I've been doing FP in javascript but I guess I'm not. Sometimes I'm still using some ifs inside my function (probably just to check if the input is null) and then you said that there are no if statement in FP. So how does the real FP handle the if condition? using ternary operator? (I saw that in your slides) and if it does use ternary, doesn't it just the same? Btw, superb presentation!
@madsimonj
@madsimonj 3 жыл бұрын
@@hirisraharjo the ternary expression is an operator, not a statement, so its fine. Its a quick way of performing somd logic, but without the messy tendencies of true If statements. Also- thanks. I'll try and make more when I have time
@ghostg6107
@ghostg6107 2 жыл бұрын
Great talk!
@simonpainter2242
@simonpainter2242 2 жыл бұрын
Thanks :)
@mikepike2000
@mikepike2000 4 жыл бұрын
I'm sorry, I think I have looked everywhere for the link to the slides?? Anyone see it?
@mikepike2000
@mikepike2000 4 жыл бұрын
Found it.. he left off the h so it didn't appear to be a link: www.dropbox.com/s/wfcug5871erbfzc/Functional%20C-Sharp%20-%202020-01.pptx?dl=0
@dotnetsheff
@dotnetsheff 4 жыл бұрын
Thanks Micheal, We'll stick it in the description too!
@tarktaro3861
@tarktaro3861 3 жыл бұрын
Awesome
@simonpainter2242
@simonpainter2242 2 жыл бұрын
Thanks :)
@DoorThief
@DoorThief 3 жыл бұрын
Woaaah
@simonpainter2242
@simonpainter2242 2 жыл бұрын
That's a good "Wooah", I'm hoping!
@madsimonj
@madsimonj 4 жыл бұрын
Also, for anyone interested, my website & blog are here: www.thecodepainter.co.uk
@tsooooooo
@tsooooooo 3 жыл бұрын
Good intro but can't agree that FP is bad for UI programming!
@simonpainter2242
@simonpainter2242 2 жыл бұрын
it's not that it's bad, per se. It's more that you have to make some sort of compromise at that point.
@emilorefors6277
@emilorefors6277 2 жыл бұрын
As far as i know there's no difference between linq select and map
@simonpainter2242
@simonpainter2242 2 жыл бұрын
There is. Select operates exclusively on Enumerables (and derivatives) an element at a time, so 'x' for a Select statement is an individual item in an array of some kind. Map operates on _any_ object and on the whole object, so you could call Map on a string, or an integer. If you called Map on an Enumerable, then 'x' would be the entire enumerable, not just a single element of it.
@emilorefors6277
@emilorefors6277 2 жыл бұрын
@@simonpainter2242 but what would be the practical difference when running it on a collection?
@simonpainter2242
@simonpainter2242 2 жыл бұрын
@@emilorefors6277 if you passes an arrow function with a parameter 'x' to a Select statement on at Enumerable, then the type of x is T. If you called Map on that same Enumerable, then x would have the type Enumerable. I.e. map operates on the whole original object, not just individual elements within it
@emilorefors6277
@emilorefors6277 2 жыл бұрын
@Simon Painter im pretty sure this is not how it works. For example, map in javascript and also in f#, will both have x being the type of T
@simonpainter2242
@simonpainter2242 2 жыл бұрын
@@emilorefors6277 you're right, but we have Select in C# that performs the same role as Map in JS. I _could_ have called it Bind too, but I thought that Map was a friendlier name
@chrisbaker5284
@chrisbaker5284 2 жыл бұрын
I would have watched more of this but many of the slides are cut off at the bottom, which is very annoying. The first 10 minutes talk about how wonderful functional programming is, the implication it is better then OO, which is not true. Both paradigms have their advantages and disadvantages. I'm a programmer of more than 20 years and I am always happy to learn and try new things, but forcing an OO language to use functional paradigms is a bit like using a spanish guitar to play heavy metal - it's just plain wrong. If you want to do functionla programming use a functional programming language! Functional programming does not hold state and is stateless? And becasue of that it is great at data processing. But as it is stateless what data does it process? Immutablity is where you get better thread safety and while that concept may have originated from the mathematical functional world it's not a functional programming feature, you can create immutable classes in c# (and I have been for years), that doesn't make it functional.
@undeadspez
@undeadspez 3 жыл бұрын
When is Functional Programming *not*: UI React: I beg to differ
@Qrzychu92
@Qrzychu92 3 жыл бұрын
Elm: B**** please :P
@simonpainter2242
@simonpainter2242 2 жыл бұрын
It's not that Functional can't do UI, it's more that compromises have to be made at that point. You can't write an applicaiton entirely of side-effect free pure functions and still have external interactions.
@joandimko3063
@joandimko3063 5 жыл бұрын
some code samples are cut and not readable :-( and you are talking about readability :-)
@madsimonj
@madsimonj 4 жыл бұрын
Which ones? I can pass you a copy of the slides, if you like?
@dotnetsheff
@dotnetsheff 4 жыл бұрын
That's our fault, not the speakers, HDMI recording seemed to have been cropped 😢 sorry about that.
@madsimonj
@madsimonj 4 жыл бұрын
I've added a link to the slides now
@ayoubihbibibi2404
@ayoubihbibibi2404 4 жыл бұрын
why are you like that ? we have free and great explanation on functional programming , and you are still not happy ...you could have stopped with the first line of your comment. Please reboot or format/ reinstall your mindset ...you will make life very hard for you and people around you otherwise :(
@drunkonmonads
@drunkonmonads 3 жыл бұрын
I have used language extensions which encapsulates the ideas mentioned here so no need to write own version. Great talk.
@drunkonmonads
@drunkonmonads 3 жыл бұрын
While not covered in video I actually saw just now that the slides talk of language extensions as well.
@simonpainter2242
@simonpainter2242 2 жыл бұрын
Yeah, LangExt is out there & seems fine. I'm not necessarily advocating everyone to go out and write your own implementation of this, but I think it's important to know how you *might* do it, to help with understanding.
Using Immutable Data Structures in C# and .NET - Spencer Schneidenbach
47:27
Functional Programming in 40 Minutes • Russ Olsen • GOTO 2018
41:35
GOTO Conferences
Рет қаралды 821 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
The functional journey of C# - Mads Torgersen - NDC Copenhagen 2022
1:01:28
Functional Programming with C# - Simon Painter - NDC Oslo 2020
1:03:21
NDC Conferences
Рет қаралды 12 М.
An introduction to functional programming with C#
1:25:32
Software Craftsmanship Luxembourg
Рет қаралды 10 М.
Looks GREAT To Me: Getting Past Bare Minimum Code Reviews
51:13
dotnetsheff
Рет қаралды 1,5 М.
Functional Design Patterns - Scott Wlaschin
1:05:50
NDC Conferences
Рет қаралды 301 М.
Fluent Method Chaining in C#
44:42
dotnetsheff
Рет қаралды 1,1 М.
F# for C# programmers - Scott Wlaschin
1:00:01
NDC Conferences
Рет қаралды 69 М.
.NET Configuration Easy... Right
56:13
dotnetsheff
Рет қаралды 1,5 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН