F# Eye 4 the C# GuyPhillip Trelford@ptrelfordhttp://trelford.com/blog
Visual F#
The F in F# is for FUN!
Halo 3 with F# Skills
XBLA: Path to Go – F# AI
Facebook: Monopoly
F#• Statically Typed• Functional• Object Orientated• Open Source• .Net language• In Visual Studio& Xamarin Studio
F# for Profit• Time to Market• Efficiency• Correctness• Complexity
Time to marketspeed development by 50 percent or more,European IBorder of magnitude increase in productivity,GameSys
Efficiencyprocesses that used to require hours now take just minutes,Grange Insuranceperformance is 10× better than the C+...
Correctnessleads to virtually bug-free code,Fixed IncomeI am still waiting for the first bug to come in,E-On
Complexityeverything becomes simple and clear when expressed in F#,Byron Cook
DEMOS
Light Syntax: POCOsF#type Person(name:string,age:int) =/// Full namemember person.Name = name/// Age in yearsmember person...
Light Syntax: DIF#type VerySimpleStockTraderImpl(analysisService:IStockAnalysisService,brokerageService:IOnlineBrokerageSe...
Unit TestingF# NUnitmodule MathTest =open NUnit.Frameworklet [<Test>] ``2 + 2 should equal 4``() =Assert.AreEqual(2 + 2, 4...
MockingF# Foqlet [<Test>] ``order sends mail if unfilled``() =// setup datalet order = Order("TALISKER", 51)let mailer = m...
Tickspec: Debugging
FunScriptTypeScript Type Provider
Try F#:http://tryfsharp.org
RESOURCES
F# Books
F#UNCTIONAL LONDONERS• 550 Members• Founded 2010• Meets every 2 weeks
Meet the F#ersTwitter #fsharp@rickasaurus@tomaspetricek@jonharrop
Show me the money!
Questions?Twitter:@ptrelfordBlog:http://trelford.com/blogFoundation:http://fsharp.org
Upcoming SlideShare
Loading in...5
×

F# eye for the C# guy - NorDev Norwich

768

Published on

Introduction to the F# language for curious C# developers

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
768
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • MonoDevelop,Emacs &amp; VIM
  • F# eye for the C# guy - NorDev Norwich

    1. 1. F# Eye 4 the C# GuyPhillip Trelford@ptrelfordhttp://trelford.com/blog
    2. 2. Visual F#
    3. 3. The F in F# is for FUN!
    4. 4. Halo 3 with F# Skills
    5. 5. XBLA: Path to Go – F# AI
    6. 6. Facebook: Monopoly
    7. 7. F#• Statically Typed• Functional• Object Orientated• Open Source• .Net language• In Visual Studio& Xamarin Studio
    8. 8. F# for Profit• Time to Market• Efficiency• Correctness• Complexity
    9. 9. Time to marketspeed development by 50 percent or more,European IBorder of magnitude increase in productivity,GameSys
    10. 10. Efficiencyprocesses that used to require hours now take just minutes,Grange Insuranceperformance is 10× better than the C++ that it replaces,Aviva
    11. 11. Correctnessleads to virtually bug-free code,Fixed IncomeI am still waiting for the first bug to come in,E-On
    12. 12. Complexityeverything becomes simple and clear when expressed in F#,Byron Cook
    13. 13. DEMOS
    14. 14. Light Syntax: POCOsF#type Person(name:string,age:int) =/// Full namemember person.Name = name/// Age in yearsmember person.Age = ageC#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/// </summary>public int Age{get { return _age; }}}
    15. 15. Light Syntax: DIF#type VerySimpleStockTraderImpl(analysisService:IStockAnalysisService,brokerageService:IOnlineBrokerageService) =interface IAutomatedStockTrader withmember this.ExecuteTrades() =() // ...C#public class VerySimpleStockTraderImpl: IAutomatedStockTrader{private readonlyIStockAnalysisService analysisService;private readonlyIOnlineBrokerageService brokerageService;public VerySimpleStockTraderImpl(IStockAnalysisService analysisService,IOnlineBrokerageService brokerageService){this.analysisService = analysisService;this.brokerageService = brokerageService;}public void ExecuteTrades(){// ...}}
    16. 16. Unit TestingF# NUnitmodule MathTest =open NUnit.Frameworklet [<Test>] ``2 + 2 should equal 4``() =Assert.AreEqual(2 + 2, 4)C# NUnitusing NUnit.Framework;[TestFixture]public class MathTest{[Test]public voidTwoPlusTwoShouldEqualFour(){Assert.AreEqual(2 + 2, 4);}}
    17. 17. MockingF# Foqlet [<Test>] ``order sends mail if unfilled``() =// setup datalet order = Order("TALISKER", 51)let mailer = mock()order.SetMailer(mailer)// exerciseorder.Fill(mock())// verifyverify <@ mailer.Send(any()) @> onceC# Moqpublic void OrderSendsMailIfUnfilled(){// setup datavar order = new Order("TALISKER", 51);var mailer = new Mock<MailService>();order.SetMailer(mailer.Object);// exerciseorder.Fill(Mock.Of<Warehouse>());// verifymailer.Verify(mock =>mock.Send(It.IsAny<string>()),Times.Once());}
    18. 18. Tickspec: Debugging
    19. 19. FunScriptTypeScript Type Provider
    20. 20. Try F#:http://tryfsharp.org
    21. 21. RESOURCES
    22. 22. F# Books
    23. 23. F#UNCTIONAL LONDONERS• 550 Members• Founded 2010• Meets every 2 weeks
    24. 24. Meet the F#ersTwitter #fsharp@rickasaurus@tomaspetricek@jonharrop
    25. 25. Show me the money!
    26. 26. Questions?Twitter:@ptrelfordBlog:http://trelford.com/blogFoundation:http://fsharp.org

    ×