Category Archives: F#

Don’t Misuse Lambdas

Avoid Duplicating Code It’s great that so many C# and VB.NET developers are taking advantage of LINQ. Unfortunately, using LINQ can encourage you to misuse lambdas. Consider the following simple example: Square is a useful utility function. It shouldn’t be defined as a lambda because that ensures code duplication instead of reuse. It’s more obvious […]

Also posted in C#, Functional | 17 Responses

Designing F# Functions for Currying and the |> Operator

Last week, I led a jam about F# at the Ann Arbor Study Group. One of my SRT Solutions coworkers, Ben Barefield, asked a question that warrants further discussion. After I introduced the forward pipe (|>) operator, Ben asked the following: In F# programming, do you design functions so the last argument is one that […]

Also posted in Currying, Functional | Leave a comment

Option Types vs Nullable Types

Some of the feedback that we’ve received about Elevate has to do with Option types and how they are different or similar to Nullable types in C#. Luke Hoban does a great job of describing some of the differences here: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=470052 If you’ve played around with Option types in F# or another functional language, you […]

Also posted in C#, Elevate, Functional | 4 Responses

Introducing Elevate

The past few weeks, a few other SRT Solutions developers and I have been working on a new open source library called Elevate. We went public with the source on CodePlex this weekend, and although we’re still in the early stages of development, I already rely on many of the functional programming features of the […]

Also posted in C#, Elevate, Functional, SrtInsights | 56 Responses

F# For C# Programmers: Programming In the Small

During CodeMash this past January, I had the opportunity to talk with Chris Smith about F#. One of the things that he considered to be a sweet spot for the language was programming “in the small”. At the time, I didn’t completely agree with his claim, but after writing more F# and functional C# code, […]

Also posted in C#, Functional | Leave a comment

Early Impressions – F# in Visual Studio 2010 Beta 1 and May CTP

First thing’s first. If you’re interested in an in depth description of the changes to F# in the 2010 beta and the May CTP, look no further than this post by Don Syme. Clearly, the F# team has been busy: http://blogs.msdn.com/dsyme/archive/2009/05/20/visual-studio-2010-beta1-with-f-is-now-available-plus-matching-f-ctp-update-for-vs2008.aspx After parsing the above notes and spending a little time with the new version […]

Also posted in Visual Studio | 4 Responses

Writing BDD-Style tests in F# with xUnit.net

Recently, I’ve been exploring different options for testing in F#. I was pleased to find out that there has been some good work done in this space already: Matthew Podowysoki’s Functional Programming Unit Testing series is a great overview of testing in F#. The FsUnit project is a specification style testing framework written in F#. […]

Also posted in testing, xunit | Leave a comment

F# Performance Testing: F# Types vs Structs and Classes

F# introduces Record Types and Descriminated Unions to the .NET universe. Although I knew that these types eventually boiled down to reference types, I wanted to make sure that nothing funny was going on behind the scenes when they got instantiated. The results weren’t terribly exciting, but I learned some important things about performance testing […]

Posted in F# | 2 Responses

The Code Behind Paint Wars: Merging Functional and OOP

This post is the fourth in a series of posts about the code behindPaintWars. In this series, I will be talking about how the design and implementation of the game differed in C# and F#.  Along the way, I’ll also be talking about some of the fun and exciting features of the F# language and […]

Also posted in Functional, Paint Wars, SrtInsights | Leave a comment

The Code Behind Paint Wars: Functional Design

This post is the third in a series of posts about the code behind PaintWars. In this series, I will be talking about how the design and implementation of the game differed in C# and F#.  Along the way, I’ll also be talking about some of the fun and exciting features of the F# language […]

Also posted in Functional, Paint Wars, SrtInsights | Leave a comment