SlideShare a Scribd company logo
Phil Trelford, @ptrelford
#SDDConf, London, 2015
 Founded Feb 2010
 950+ Members
 Meets every 2 weeks
 Topics include
 Machine Learning
 Finance
 Games
 Web
http://meetup.com/fsharplondon
Online & offline groups at
http://fsharp.org/groups
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
 Statically Typed
 Functional First
 Object Orientated
 Open Source
 .Net language
 In Visual Studio
& Xamarin Studio
Kaggle Testimonial
“we have a large existing code
base in C#,
…getting started with F# was
an easy decision.”
“The F# code is consistently
shorter, easier to read, easier
to refactor and contains far
fewer bugs.
…we’ve become more
productive.”
Source: http://fsharp.org/testimonials/
Phil Trelford, @ptrelford
#SDDConf, London, 2015
 Time to Market
 Efficiency
 Correctness
 Complexity
speed development by 50 percent or more,
European IB
order of magnitude increase in productivity,
GameSys
processes that used to require hours now take just minutes
Grange Insurance
performance is 10× better than the C++ that it replaces
Aviva
leads to virtually bug-free code,
Fixed Income
I am still waiting for the first bug to come in,
E-On
Billion-dollar mistake
I call it my billion-dollar mistake. It was the invention
of the null reference in 1965. […] I couldn't resist the
temptation to put in a null reference, simply because
it was so easy to implement. This has led to
innumerable errors, vulnerabilities, and system
crashes, which have probably caused a billion dollars
of pain and damage in the last forty years.
Tony Hoare
I call it my billion-dollar mistake. It was the invention
of the null reference in 1965. […] I couldn't resist the
temptation to put in a null reference, simply because
it was so easy to implement. This has led to
innumerable errors, vulnerabilities, and system
crashes, which have probably caused a billion dollars
of pain and damage in the last forty years.
Tony Hoare
everything becomes simple and clear when expressed in F#,
Byron Cook, Microsoft Research
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
Phil Trelford, @ptrelford
#SDDConf, London, 2015
F#
type Person(name:string,age:int) =
/// Full name
member person.Name = name
/// Age in years
member person.Age = age
C#
public class Person
{
public Person(string name, int age)
{
_name = name;
_age = age;
}
private readonly string _name;
private readonly int _age;
/// <summary>
/// Full name
/// </summary>
public string Name
{
get { return _name; }
}
/// <summary>
/// Age in years
F#
type VerySimpleStockTrader
(analysisService:IStockAnalysisService,
brokerageService:IOnlineBrokerageService) =
member this.ExecuteTrades() =
() // ...
C#
public class VerySimpleStockTrader
{
private readonly
IStockAnalysisService analysisService;
private readonly
IOnlineBrokerageService brokerageService;
public VerySimpleStockTrader(
IStockAnalysisService analysisService,
IOnlineBrokerageService brokerageService)
{
this.analysisService = analysisService;
this.brokerageService = brokerageService;
}
public void ExecuteTrades()
{
// ...
}
}
for i = 1 to 100 do
let text =
if i % 3 = 0 && i % 5 = 0 then "FizzBuzz"
elif i % 3 = 0 then "Fizz"
elif i % 5 = 0 then "Buzz"
else i.ToString()
Console.WriteLine(text)
for i = 1 to 100 do
match i%3, i%5 with
| 0, 0 -> "FizzBuzz"
| 0, _ -> "Fizz"
| _, 0 -> "Buzz"
| _, _ -> i.ToString()
|> Console.WriteLine
F# for C# devs - SDD 2015
F# NUnit
module MathTest =
open NUnit.Framework
let [<Test>] ``2 + 2 should equal 4``() =
Assert.AreEqual(2 + 2, 4)
C# NUnit
using NUnit.Framework;
[TestFixture]
public class MathTest
{
[Test]
public void TwoPlusTwoShouldEqualFour()
{
Assert.AreEqual(2 + 2, 4);
}
}
F# Foq
let ``order sends mail if unfilled``() =
// setup data
let order = Order("TALISKER", 51)
let mailer = mock()
order.SetMailer(mailer)
// exercise
order.Fill(mock())
// verify
verify <@ mailer.Send(any()) @> once
C# Moq
public void OrderSendsMailIfUnfilled()
{
// setup data
var order = new Order("TALISKER", 51);
var mailer = new Mock<MailService>();
order.SetMailer(mailer.Object);
// exercise
order.Fill(Mock.Of<Warehouse>());
// verify
mailer.Verify(mock =>
mock.Send(It.IsAny<string>()),
Times.Once());
}
F# for C# devs - SDD 2015
open FSharp.Data
type Person = JsonProvider<""" { "name":"Name", "age":64 } """>
let thomas = Person.Parse(""" { "name":"Thomas", "age":12 } """)
person.Age
R – TYPE PROVIDER
F# for C# devs - SDD 2015
Phil Trelford, @ptrelford
#SDDConf, London, 2015
F# Software Foundation
http://www.fsharp.org
software stacks
trainings teaching F# user groups snippets
mac and linux cross-platform books and tutorials
F# community open-source MonoDevelop
contributions research support
consultancy mailing list
//---------------------------------------------------------------
// About Let
//
// The let keyword is one of the most fundamental parts of F#.
// You'll use it in almost every line of F# code you write, so
// let's get to know it well! (no pun intended)
//---------------------------------------------------------------
[<Koan(Sort = 2)>]
module ``about let`` =
[<Koan>]
let LetBindsANameToAValue() =
let x = 50
AssertEquality x __
F# for C# devs - SDD 2015
F# for C# devs - SDD 2015
 Twitter
 @ptrelford
 Blog
 http://trelford.com/blog
 F# eXchange:
 http://tinyurl.com/fsharpex

More Related Content

PPTX
F# for C# devs - Leeds Sharp 2015
PPTX
F# for C# devs - NDC Oslo 2015
PDF
What every beginning developer should know
PPT
bai giang java co ban - java cơ bản - bai 2
PPT
Cantonese Opera As Intangible Cultural Heritage
PPTX
Build a compiler in 2hrs - NCrafts Paris 2015
PPTX
F# for Trading - Øredev 2013
PPTX
Machine learning from disaster - GL.Net 2015
F# for C# devs - Leeds Sharp 2015
F# for C# devs - NDC Oslo 2015
What every beginning developer should know
bai giang java co ban - java cơ bản - bai 2
Cantonese Opera As Intangible Cultural Heritage
Build a compiler in 2hrs - NCrafts Paris 2015
F# for Trading - Øredev 2013
Machine learning from disaster - GL.Net 2015

Viewers also liked (20)

PPTX
F# for C# devs - Copenhagen .Net 2015
PPTX
F# for Trading - QuantLabs 2014
PPTX
F# in your pipe
PPTX
24 hours later - FSharp Gotham 2015
PPTX
Keyboard warriors #1 copenhagen performance
PPTX
24 Hours Later - NCrafts Paris 2015
PPTX
Beyond lists - Copenhagen 2015
PPTX
Beyond Lists - Functional Kats Conf Dublin 2015
PPTX
F# in Finance Tour
PPTX
F# eXchange Keynote 2016
PDF
Building a web application with ontinuation monads
PPTX
Building cross platform games with Xamarin - Birmingham 2015
PPTX
Generative Art - Functional Vilnius 2015
PPTX
FSharp eye for the Haskell guy - London 2015
PPTX
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
PPTX
FSharp On The Desktop - Birmingham FP 2015
PPTX
Creating own language made easy
PPTX
Write Your Own Compiler in 24 Hours
PPTX
FParsec Hands On - F#unctional Londoners 2014
KEY
Let's build a parser!
F# for C# devs - Copenhagen .Net 2015
F# for Trading - QuantLabs 2014
F# in your pipe
24 hours later - FSharp Gotham 2015
Keyboard warriors #1 copenhagen performance
24 Hours Later - NCrafts Paris 2015
Beyond lists - Copenhagen 2015
Beyond Lists - Functional Kats Conf Dublin 2015
F# in Finance Tour
F# eXchange Keynote 2016
Building a web application with ontinuation monads
Building cross platform games with Xamarin - Birmingham 2015
Generative Art - Functional Vilnius 2015
FSharp eye for the Haskell guy - London 2015
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
FSharp On The Desktop - Birmingham FP 2015
Creating own language made easy
Write Your Own Compiler in 24 Hours
FParsec Hands On - F#unctional Londoners 2014
Let's build a parser!
Ad

Similar to F# for C# devs - SDD 2015 (20)

PPTX
F# Eye for the C# guy - Øredev 2013
PPTX
F# Eye For The C# Guy - f(by) Minsk 2014
PPTX
F# eye for the C# guy - NorDev Norwich
PPTX
F# Eye 4 the C# Guy
PPTX
FSharp in the enterprise
PPTX
F# Eye for the C# Guy - DDD North 2013
PPTX
F# Eye For The C# Guy - Seattle 2013
PPTX
FP Day 2011 - Turning to the Functional Side (using C# & F#)
PDF
Domain Driven Design with the F# type System -- NDC London 2013
PPTX
TechDaysNL 2015 - F# for C# Developers
PPTX
Reasonable Code With Fsharp
PDF
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
PDF
The F# Path to Relaxation
PDF
"Introduction to F#" - South Dakota Code Camp, November 5, 2011
PPTX
Real World F# - SDD 2015
PPT
F# Eye for the C# Guy
PPTX
C# 6.0 - What?! C# is being updated?
PPTX
C# Today and Tomorrow
PPTX
"The F# Path to Relaxation", Don Syme
PPTX
Can F# make us better as .NET developers?
F# Eye for the C# guy - Øredev 2013
F# Eye For The C# Guy - f(by) Minsk 2014
F# eye for the C# guy - NorDev Norwich
F# Eye 4 the C# Guy
FSharp in the enterprise
F# Eye for the C# Guy - DDD North 2013
F# Eye For The C# Guy - Seattle 2013
FP Day 2011 - Turning to the Functional Side (using C# & F#)
Domain Driven Design with the F# type System -- NDC London 2013
TechDaysNL 2015 - F# for C# Developers
Reasonable Code With Fsharp
Domain Driven Design with the F# type System -- F#unctional Londoners 2014
The F# Path to Relaxation
"Introduction to F#" - South Dakota Code Camp, November 5, 2011
Real World F# - SDD 2015
F# Eye for the C# Guy
C# 6.0 - What?! C# is being updated?
C# Today and Tomorrow
"The F# Path to Relaxation", Don Syme
Can F# make us better as .NET developers?
Ad

Recently uploaded (20)

PPTX
L1 - Introduction to python Backend.pptx
PPTX
Transform Your Business with a Software ERP System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
AI in Product Development-omnex systems
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
System and Network Administraation Chapter 3
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
L1 - Introduction to python Backend.pptx
Transform Your Business with a Software ERP System
How to Migrate SBCGlobal Email to Yahoo Easily
Upgrade and Innovation Strategies for SAP ERP Customers
Wondershare Filmora 15 Crack With Activation Key [2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
AI in Product Development-omnex systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
System and Network Administraation Chapter 3
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
VVF-Customer-Presentation2025-Ver1.9.pptx
Operating system designcfffgfgggggggvggggggggg
wealthsignaloriginal-com-DS-text-... (1).pdf
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
Internet Downloader Manager (IDM) Crack 6.42 Build 41

F# for C# devs - SDD 2015

  • 2.  Founded Feb 2010  950+ Members  Meets every 2 weeks  Topics include  Machine Learning  Finance  Games  Web http://meetup.com/fsharplondon
  • 3. Online & offline groups at http://fsharp.org/groups
  • 8.  Statically Typed  Functional First  Object Orientated  Open Source  .Net language  In Visual Studio & Xamarin Studio
  • 9. Kaggle Testimonial “we have a large existing code base in C#, …getting started with F# was an easy decision.” “The F# code is consistently shorter, easier to read, easier to refactor and contains far fewer bugs. …we’ve become more productive.” Source: http://fsharp.org/testimonials/
  • 11.  Time to Market  Efficiency  Correctness  Complexity
  • 12. speed development by 50 percent or more, European IB order of magnitude increase in productivity, GameSys
  • 13. processes that used to require hours now take just minutes Grange Insurance performance is 10× better than the C++ that it replaces Aviva
  • 14. leads to virtually bug-free code, Fixed Income I am still waiting for the first bug to come in, E-On
  • 15. Billion-dollar mistake I call it my billion-dollar mistake. It was the invention of the null reference in 1965. […] I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. Tony Hoare I call it my billion-dollar mistake. It was the invention of the null reference in 1965. […] I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. Tony Hoare
  • 16. everything becomes simple and clear when expressed in F#, Byron Cook, Microsoft Research
  • 20. F# type Person(name:string,age:int) = /// Full name member person.Name = name /// Age in years member person.Age = age C# public class Person { public Person(string name, int age) { _name = name; _age = age; } private readonly string _name; private readonly int _age; /// <summary> /// Full name /// </summary> public string Name { get { return _name; } } /// <summary> /// Age in years
  • 21. F# type VerySimpleStockTrader (analysisService:IStockAnalysisService, brokerageService:IOnlineBrokerageService) = member this.ExecuteTrades() = () // ... C# public class VerySimpleStockTrader { private readonly IStockAnalysisService analysisService; private readonly IOnlineBrokerageService brokerageService; public VerySimpleStockTrader( IStockAnalysisService analysisService, IOnlineBrokerageService brokerageService) { this.analysisService = analysisService; this.brokerageService = brokerageService; } public void ExecuteTrades() { // ... } }
  • 22. for i = 1 to 100 do let text = if i % 3 = 0 && i % 5 = 0 then "FizzBuzz" elif i % 3 = 0 then "Fizz" elif i % 5 = 0 then "Buzz" else i.ToString() Console.WriteLine(text)
  • 23. for i = 1 to 100 do match i%3, i%5 with | 0, 0 -> "FizzBuzz" | 0, _ -> "Fizz" | _, 0 -> "Buzz" | _, _ -> i.ToString() |> Console.WriteLine
  • 25. F# NUnit module MathTest = open NUnit.Framework let [<Test>] ``2 + 2 should equal 4``() = Assert.AreEqual(2 + 2, 4) C# NUnit using NUnit.Framework; [TestFixture] public class MathTest { [Test] public void TwoPlusTwoShouldEqualFour() { Assert.AreEqual(2 + 2, 4); } }
  • 26. F# Foq let ``order sends mail if unfilled``() = // setup data let order = Order("TALISKER", 51) let mailer = mock() order.SetMailer(mailer) // exercise order.Fill(mock()) // verify verify <@ mailer.Send(any()) @> once C# Moq public void OrderSendsMailIfUnfilled() { // setup data var order = new Order("TALISKER", 51); var mailer = new Mock<MailService>(); order.SetMailer(mailer.Object); // exercise order.Fill(Mock.Of<Warehouse>()); // verify mailer.Verify(mock => mock.Send(It.IsAny<string>()), Times.Once()); }
  • 28. open FSharp.Data type Person = JsonProvider<""" { "name":"Name", "age":64 } """> let thomas = Person.Parse(""" { "name":"Thomas", "age":12 } """) person.Age
  • 29. R – TYPE PROVIDER
  • 32. F# Software Foundation http://www.fsharp.org software stacks trainings teaching F# user groups snippets mac and linux cross-platform books and tutorials F# community open-source MonoDevelop contributions research support consultancy mailing list
  • 33. //--------------------------------------------------------------- // About Let // // The let keyword is one of the most fundamental parts of F#. // You'll use it in almost every line of F# code you write, so // let's get to know it well! (no pun intended) //--------------------------------------------------------------- [<Koan(Sort = 2)>] module ``about let`` = [<Koan>] let LetBindsANameToAValue() = let x = 50 AssertEquality x __
  • 36.  Twitter  @ptrelford  Blog  http://trelford.com/blog  F# eXchange:  http://tinyurl.com/fsharpex

Editor's Notes

  • #4: Community Matters Python Principle Early adopters = Traders > Developers Excel F# Hedge Funds Banks IT Departments are Conservative Language/Tool approve list Running VS2005/2008 (via phone interviews) Credit Suisse, Trafigura, BarCap
  • #5: MonoDevelop, Emacs & VIM
  • #10: http://fsharp.org/testimonials/#kaggle-1 Don’t throw out the baby with the bath water