Upload
isaac-abraham
View
258
Download
5
Embed Size (px)
DESCRIPTION
Slideset being used for my Power of F# talk designed for delivery to C# and VB .NET developers.
Citation preview
The power of F#
About me…
• .NET dev / contractor / consultant since .NET 1.0•Now works CTO of Elastacloud and as a freelance consultant
• Twitter @ isaac_abraham• Blog @ http://cockneycoder.wordpress.com• Email @ [email protected]
A confession…
Functional programming?!?
•Why hasn’t functional programming taken off until now?•Do we need to re-evaluate what problems OO is best placed to solve?
Objects now and then
Objects in the 90s
•Inheritance •State•Identity
Objects today
•Composition•Immutability•Structural equality
The beginning of the end…
• CPU clock speed has reached a peak• Multicore programming is not going away• Multithreading
• Single machine computing no longer sufficient for data-intensive problems• Distributed computing
• Azure, AWS etc. etc. compute platforms
• Same problem but x10,000
• Systems are becoming more complex• Harder to reason about• More expensive to build• More expensive to maintain
Features and Benefits of FP
FP with .NET today
• Lambda expressions• Func<T>• Anonymous Types• Extension methods allow method chaining
• LINQ• Task Parallel Library
Languages today
Object Oriented Functional
Java
Haskell
C#VB .N
ET Scala
F#
What is F# designed for?
•Writing simple code to solve complex problems
• F# 2.0 (Visual Studio 2010)• Business domain logic• Financial and maths-heavy problem solving• General problem domain exploration• Asynchronous coding
• F# 3.0 (Visual Studio 2012)• “Information Rich” data access• Improved tooling etc.
Where does F# fit into .NET?
.NET CLR / VM
MSIL
Compiler
C# VB Compiler
F#
Demo
Lots that I didn’t cover!
• Pattern Matching•Discriminated Unions•Option Types• Events• Classes and Interfaces• Custom Operators•Units of Measure
Want to learn more?
•Web• http://www.tryfsharp.org/• http://fsharpforfunandprofit.com/• http://fsharp.org/
•User Groups• http://www.meetup.com/FSharpLondon/
Summary
• C# / VB offers some functional constructs• Definitely useful!• But they are somewhat limited and / or clunky
• F# offers a smarter compiler to give us many advantages• Quicker• Easier to reason about• Safer• Interoperates with other .NET languages + framework• Fall back to “classic” OO-style if you want
DON’T FEAR THE FUNCTION!