The person that said that was Ralf Herbrich, a researcher at cambridge MSR who is uses F# heavily in his research. He sometimes post to this forum as SniperEye so maybe he'll post something on this thread too.

It's hard to qualify exactly what makes F# code more productive as it tends to be a combindation of little things rather than any one specific thing. Broadly speaking you can think of the productivity gains from F# as coming from too areas "things that make F# code less verbose" and "specific features of F# that tackle problematic areas of programming".

Under the category "things that make F# code less verbose" I would place:
- Less need for type anonations
- Less need for modifiers such as "public", "static" etc.
- Literals tend to be much less verbose, a list of elements is just [1; 2; 3]
- Higher order functions allow you to refactor code so there is no need for any copy and paste reuse
- The libraries of higher order functions (Seq.map, Seq.iter, Seq.fold etc.) help you preform common tasks in few lines of code that you'd need in C#
- The pipe operator |> helps you link functions together without the need for declaring intermediate values
- Features of the language tend to be expressions rather than statements, which generally leads to things fiting together more easily

Under the category "specific features of F# that tackle problematic areas of programming" I would place F# "asyncronous workflows" feature, which makes just .NET asynchronous programming model much easier.

Althought might seem a bit dry and accedmic, so it maybe easier to just port one of your small C# applications or smallish C# applications to F# and look at the differnces. If your not satified with the results feel free to post the program here and I'm sure someone in the commuite will help you make it better.

Cheers,
Rob

By on 2/15/2008 5:09 AM ()

1) I realize more often that I'm repeating myself in functional programming than in OO or Imperative programming.

Why?
I could say that the is because of the higher order functions or automatic generalization
But sometimes just the type signatures give me hints.

2) I don't know much C#. I come from Javaland, but I can say that F# (like other programming languages) allows you to model things more pragmatically. You don't have to attach modeling with objects and big class hierarchies just because is the only things that your programming language gives you.

3) Maybe is something that only happens to me, but sometimes I'm not as productive as I should. Even when I get things done in less lines I keep thinking (I know it's a better way! It's not as elegant as it should!) ... Then, I find it and I get really satisfied. That kind of satisfaction can make me work harder and happier than in other programming languages.

By on 2/15/2008 8:17 AM ()

Working with F# has made me realize just how much boilerplate I normally write. Stuff like this:

1
2
3
4
5
6
List<Thing> l = new List<Thing>();
foreach (OtherThing o in someOtherCollection) {
    if (someCondition)
         l.Add(o);
}
return l.AsReadOnly();

That should be one line. The sample C# below is really no improvement:

1
2
3
4
new List<OtherThing>(someOtherCollection).ConvertAll<Thing>)(delegate (OtherThing o) {
      // Do some stuff, then...
       return new Thing(o, someOtherArgument);
   }).AsReadOnly();

And my coworkers also dislike it when I write code like that!

By on 2/21/2008 5:56 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper