Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I choose F# to develop a distributed server platform? [closed]

Tags:

f#

I am currently in the research phase for a new distributed server framework that will be used for real time simulations (20,000+ clients). We had made a decision to use C#/.NET as our platform, but someone recently passed me some articles on F# and, from the surface, it looks like a great tool to use in developing the server. I am looking for some thoughts from someone who has used F# to solve large, real world, problems.

  • Is F# a good tool for this?

  • What are the pitfalls? We are dealing with lots of interacting messages and a lot of changing state, although that will likely live in a DB cloud of some kind. Functional programming seems to shine in dealing with massive parallelism and distributed computing, but seems to discourage changing any kind of state.

  • Is F# going to stick around? It concerns me that it is so new and I don’t want to tie myself to a dying platform (J# anyone?)…

  • Are there any large, real world solutions (preferably servers) that are using F#?

  • Does F# work well with large teams of engineers? I am sure the answer to this is a simple yes, but I am still very unfamiliar with the language/tools.

Thank you for your time.

like image 758
Karl Strings Avatar asked Mar 02 '11 19:03

Karl Strings


People also ask

Which plan is best F or G?

Is Medicare Plan G better than Plan F? Medicare Plan G is not better than Plan F because Medicare Plan G covers one less benefit than Plan F. It leaves you to pay the Part B deductible, whereas Medigap Plan F covers that deductible.

Should I switch from F to G?

When it comes to coverage, Medicare Supplement Plan F will give you the most coverage since it's a first-dollar coverage plan and leaves you with zero out-of-pocket costs. However, when it comes to the monthly premium, if you think lower is better, then Medicare Supplement Plan G may be better for you.

What is the difference between an F and G plan?

With Plan F, the Medicare Supplement plan pays for the Part B deductible. Under Plan G, you are responsible for the Part B deductible only. Otherwise, all Part A deductibles, copays, and coinsurance are covered. Under Part B, after the deductible, the plan pays all other approved coinsurance and copays.

Which Medigap plan is better g or n?

Plan G will typically have higher premiums than Plan N because it includes more coverage. But it could save you money because out-of-pocket costs with Plan N may equal or exceed the premium difference with Plan G, depending on your specific medical needs. Costs of Medigap policies vary by state and carrier.


2 Answers

I have spent the past 7 months developing a large real-world heavily-concurrent server in F#. I cannot give you precise details but this is the largest consultancy contract my company has ever landed.

I am looking for some thoughts from someone who has used F# to solve large, real world, problems. Is F# a good tool for this?

Yes. I have no problem developing final commercial products in F# (I did it here and here) but our clients are often most impressed with rapid prototyping using F#. For example, I recently found an internal company document that quoted 3 man months to implement a feature in C++ that had taken me 4 hours with F#!

What are the pitfalls?

There are some quirks in the language but the only major problems I have encountered (that blocked my work for weeks) were bugs in .NET and poor support for Infiniband drivers on Windows, neither of which had anything specifically to do with F#. I had some minor issues with bugs in the F# libraries (e.g. TryScan is broken) but they were easy to work around once I had figured out what the problem was. The F# team have always been extremely good at providing support and accepting suggestions.

Also, note that I am one of the few people who pioneered this technology in industry so I expect you will hit fewer problems than I did and will solve them more quickly because we already solved them for you!

We are dealing with lots of interacting messages and a lot of changing state, although that will likely live in a DB cloud of some kind. Functional programming seems to shine in dealing with massive parallelism and distributed computing, but seems to discourage changing any kind of state.

That is a common misconception. In reality, almost all functional programming languages (e.g. Lisp, Scheme, Clojure, Scala, Standard ML, OCaml, F#, Erlang) are impure and rely upon uncontrolled side effects. Haskell is the only surviving purely functional language and it is completely irrelevant.

In practice, the productivity benefits of F# have more to do with type inference, pattern matching and variant types (from the ML family of languages) and other features like asynchronous workflows, mailbox processors, sequence expressions, interoperability and so on.

Is F# going to stick around? It concerns me that it is so new and I don’t want to tie myself to a dying platform (J# anyone?)…

We have been using F# for 4 years and it continues to go from strength to strength. I think it is very unlikely to die anytime soon, not least because Microsoft are making such good use of F# internally. For example, the F# share of UK job market just tripled in only four months.

Are there any large, real world solutions (preferably servers) that are using F#?

Yes, many. Microsoft continue to use it in Bing AdCenter and Halo 3 and other companies like E-ON, Grange and Credit Suisse seem to have build substantial systems with it. I suspect there are dozens more using it in secret as our client does.

Does F# work well with large teams of engineers? I am sure the answer to this is a simple yes, but I am still very unfamiliar with the language/tools.

If you mean large teams of F# programmers then I don't know: I have only ever worked in teams of up to 4 people using these kinds of languages.

If you mean how does the introduction of F# into part of a large team work, I can use my client as a case study. They had no F# 2 years ago. Today, the top two most productive teams are both using F# and they are solving problems that were believed to be unsolvable before the introduction of F# at the company. The number of people using F# regularly has increased gradually from one person two years ago to around two dozen people today. They have stopped hiring C++ developers and started requiring F# as basic knowledge for new employees.

There are inevitable political issues though. My productivity has raised eyebrows across the company and management have started to question why I am so much more cost effective, putting a lot of pressure on the teams using mainstream languages (C++ and C#). Consequently, we are now coming under fire and losing buy-in within the company because we're making others look bad. I was instructed on Friday to slow down in order to avoid making too many people look bad! So I have now been assigned to multiple projects and am repeating this "success" there. ;-)

like image 174
J D Avatar answered Dec 17 '22 04:12

J D


I'll stop commenting and make my sentiments official. I'm not going to get into the benefits of functional programming, immutability, ease of parallelism, etc. because that ground has been well-covered elsewhere on SO. Even if you don't know the first thing about functional programming, and intend to write procedural, OO, C#-ish code, I would still recommend F#.

C#

public class Person {
    private readonly string _name;
    private readonly int _age;

    public Person(string name, int age) {
        _name = name;
        _age = age;
    }

    public string Name {
        get { return _name; }
    }

    public int Age {
        get { return _age; }
    }
}

F#

type Person(name, age) =
    member this.Name = name
    member this.Age = age

I think anyone can easily shift from:

foreach (var item in items) {
    //...
}

to:

for item in items do
    //...

and most of the syntactic differences are along similar lines. You can write C#-ish code in F# and slowly ease into functional features, learning along the way. Some time later you'll not only know a new language, but a new way to think about programming problems. In the meantime, I suspect you'll be much more productive.

like image 20
Daniel Avatar answered Dec 17 '22 04:12

Daniel