Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Better Functional Programming Support Is Coming In C# 7

0.00/5 (No votes)
9 Apr 2016 1  
Get ready for the new exciting features in C# 7!

I have recently listened to .NET Rocks! episode #1272 Looking into C# 7 with Kathleen Dollard where she mentioned that the next version of C# will have better support for tuples, immutability, records and pattern matching. You can download the episode and fast forward to 27:04 and 30:04 respectively. If you are interested, you can review the C# 7 Work List of Features (revision circa March 24 2016). You can familiarize yourself with support for these features in C# 7 right now, but since it is pretty much still work in progress, by the time it hits CTP or even release – there is a big chance it will look different.

So, what can you do in the meantime? Fortunately, Visual Studio ships with F# and you can start learning the above mentioned Functional Programming concepts right now. Remember, F# is just another CLR language as C# is and many features like Generics and support for async/await came to C# from F#. When it comes to Functional Programming, I hope this trend will continue.

But why should you care about functional programming support in C# if you are primarily writing imperative style C# applications? I would encourage you to watch two excellent presentations by Uncle Bob.

The first one – SCNA 2012: Robert Martin – The Reasonable Expectations of Your CTO, fast forward to 28:22,

Quote:

I expect everyone of you to practice continuous aggressive learning... The job of a software developer, one of the primary jobs of a software developer, is to learn. We are in the industry that is moving at a tremendous pace of speed. There are new languages every couple of years, new processes all the time. We are moving along at a crazy rate. And any developer that gets a little bit behind - may not recover.

Languages come in waves and the job... the art, of being a career programmer - is the art of surfing those waves. You might be really good at Ruby right now - your career is not gonna be Ruby in 5 years. It’s gonna be something else. So, you gotta be looking ahead at the next wave. Maybe it’s Clojure, maybe it’s Scala, maybe it’s F# - who the hell knows! But you gotta be looking out there at those waves, ‘cause there will be a moment when you’ve got to hop onto the next wave and keep surfing.

You need to be learning fast... Expect to spend another 20 hours a week on your career. That’s what a professional does. Laborers do not, professionals - do.

-- Robert Martin

And the second one – Functional Programming: What? Why? When?, fast forward to 6:43. The latter video has a terrible sound, but the content is still great. I hope it will give answers to many of your questions. BTW, here is the link (hosted by MIT) to the book Structure and Interpretation of Computer Programs mentioned in the video.

If you still under the impression that Functional Programming and F# is for scientific research labs only and wonder what it can be used for – look no further than Jet.com. In .NET Rocks! episode #1240 Functional Microservices with Rachel Reese, (fast forward to 10:54), Rachel mentioned that at Jet.com they have a lot of microservices written in F# and it greatly simplified their development. Pretty interesting episode overall.

surfer

So, are you going to be ready to hop onto the next wave and keep surfing?

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here