F# Eye 4 the C# Guy - DDD Cambridge Nights 2014

50 %
50 %
Information about F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
Technology

Published on February 5, 2014

Author: ptrelford

Source: slideshare.net

Phil Trelford, @ptrelford DDD Cambridge Nights, 2014

 Statically Typed  Functional First  Object Orientated  Open Source  .Net language  In Visual Studio & Xamarin Studio

Kaggle The fact that F# targets the CLR was also critical 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.

Phil Trelford, @ptrelford DDD Cambridge, 2014

F# C# type Person(name:string,age:int) = /// Full name member person.Name = name /// Age in years member person.Age = age 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() { // ... } }

F# NUnit C# NUnit module MathTest = using NUnit.Framework; open NUnit.Framework [TestFixture] public class MathTest { [Test] public void TwoPlusTwoShouldEqualFour() { Assert.AreEqual(2 + 2, 4); } } let [<Test>] ``2 + 2 should equal 4``() = Assert.AreEqual(2 + 2, 4)

F# Foq C# Moq 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 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()); }

type formula = | Neg of formula | Exp of formula * formula | ArithmeticOp of formula * arithmetic * formula | LogicalOp of formula * logical * formula | Num of UnitValue | Ref of int * int | Range of int * int * int * int | Fun of string * formula list

open FSharp.Data type Simple = JsonProvider<""" { "name":"John", "age":94 } """> let simple = Simple.Parse(""" { "name":"Tomas", "age":4 } """) Simple.Age

Phil Trelford, @ptrelford DDD Cambridge, 2014

software stacks trainings teaching F# user groups mac and linux snippets cross-platform books and tutorials F# Software Foundation F# community open-source MonoDevelop http://www.fsharp.org 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 __

Phil Trelford, @ptrelford DDD Cambridge, 2014

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

F# Eye 4 the C# Guy - DDD Cambridge Nights 2014 - documents.mx

1.Phil Trelford, @ptrelford DDD Cambridge Nights, 2014. 2. Statically Typed Functional First Object Orientated Open Source .Net language ...
Read more

Current and Upcoming Events - fpish.net

F# Eye for the C# guy This talk is for C# programmers who are curious about F#, ... and plenty of social nights. . ... code × 4; ddd × 4; play × 4 ...
Read more

F# Eye for the C# Guy - DDD North 2013 - Technology

1.F# Eye 4 the C# Guy Phil Trelford, @ptrelford #dddnorth, Sunderland 2013 . 2. Visual F# . 3. The F in F# stands for FUN! 4. Halo 3 with F# Skills
Read more

fpish.net

fpish.net
Read more

Peliculotas

¿Qué podemos decir?. En Peliculotas nos dedicamos a subir peliculas completas en español latino sobre todos los géneros. Disfruta y comparte.
Read more

Download - UpdateStar - UpdateStar.com

UpdateStar is compatible with Windows platforms. UpdateStar has been tested to meet all of the technical requirements to be compatible with Windows 10, 8.1 ...
Read more

Kapiti News 04-06-14 by Local Newspapers - issuu

Kapiti News 04-06-14 ... Wednesday, June 4, 2014. ... DDD?L#EH]"GFOL?N"?#A. 1PH#G B"F] F#HG FH#J DPGL] OPLM PN]B%HN "] ...
Read more

Сайт aloo

Теперь у меня есть свой сайт, который я буду наполнять всякими интересностями и ...
Read more

LEADER | May 6 | 2015 by Inter-County Leader - issuu

... LEADER | May 6 | 2015 ... for the second consecutive year increasing by 4.45 percent from 2013 to 2014. ... OBAP% F#AD% @I% QBEAP ...
Read more