Partager via


F# Elevator Pitch

At the PDC I spent about eight hours a day for a full week answering the same question again and again: “What is F# and why should I use it.” While I would love to give a long and nuanced answer to this, in order to achieve a high throughput you need to resort to using the Elevator Pitch style.

The Pitch

So your boss comes to you and says your company is about to go bankrupt unless you write some application that will save the day. Having been told this time and time again you fire up Visual Studio and get to work.
The data access layer is trivial; you have code generators and UI tools to help out. The presentation layer is easy too – you have WYSIWYG designers. All you need to do them is wire these things together, which is straightforward in an object-oriented language. So from the get-go building the framework for your application is easy.

Your boss sees that your project is ‘mostly done’ and breathes a sigh of relief. He then starts stressing out about other things. But in reality, now is the time that the hard programming work begins. Conceptually you’re just putting the meat in your application – some business logic, implementing an algorithm, transforming some data. General computation. But this is really painful in C#.

Think about design patterns. They are actually really simple concepts, but require a complex web of types and interfaces to implement. This is because at heart everything in an OO language must be a class, so if you want to represent something simpler than that – a function, an algorithm, a piece of data – you have to build some OO hierarchy on top of it.

You could waste your time writing a lot of boiler plate code that has nothing to do with solving your problem, but fortunately there is a better way.

Instead of burning a week or two writing your functions and algorithms in terms of classes, you write your code in F#. F# is a new .NET programming language that approaches programming from an entirely different perspective. Abstracting algorithms, numeric computation, data analysis and exploration – all of these things are just easier in F#. Because that’s what the language is built to do.

So you write some part of your application in F# and shave weeks off your development time. And, because of the interoperability of the CLR, you can use it directly with your C# code and your boss/team is none the wiser. Your company is saved and you don’t have to work this weekend.

F# will make you extremely productive at algorithmic-level development (AKA programming in the small). So you can use F# where it makes sense and C# for everything else. F# is powerful new language for your tool belt.

Comments

  • Anonymous
    November 01, 2008
    PingBack from http://mstechnews.info/2008/11/f-elevator-pitch/

  • Anonymous
    November 01, 2008
    I'm already sold on F#, so I realise this isn't targetted at me... .. but imho this is more of a Sales pitch than an Elevator pitch. :)

  • Anonymous
    November 02, 2008
    What about the bits of functionnal programming already introduced in C# 3.0 ? We can already use lambda expression/linq "where it makes sense and C# for everything else". May be something else could be said about F# versus linq.

  • Anonymous
    November 02, 2008
    "Why use F#" - this IS a tricky question. We all work in teams of some sort and in mine it was a serious problem to make my co-workers accept C# besides VB.net (!) - so no I am not using F# for live code at the moment. BUT I'm investing considerable (free-)time to learn the language and the pardigm. Now why is that? Simple: Firstly I'm into scientifical computation and F# provides me with a fast way to implement and test new algorithms (ok the debuger needs to be improved). Then I am interessted in programming languages in general (I love Prolog and used to play with LISP9. And of course functional programming is IMHO the way to go in the future. Don't get me wrong: I think the GUI will never be build in functional style (it just feels unatural) - but as you said: the fun part of programming will be ;)

  • Anonymous
    November 04, 2008
    So far, so good.  You have this tool on your belt that shaves time off the project.  Your boss is happy - until he starts thinking about the future. He thinks, "What happens if Chris gets hit by a bus?  How easy will it be to find someone who can understand this F# thing?" Since Chris is an alpha-geek, he's had F# under his fingers for a while now.  But there are a lot of non-alphas out there who might understand the business side but not the F# side.  I've been toying with it lightly for a while now, and I'm still trying to grok the oddities of syntax in new code I encounter.  Not to mention the OO-to-functional mindset change. What do you say to the boss that comes back with "There's not much of a pool of F# talent out there - that's a lot of risk for the business to take on, not being able to easily find an F# programmer."

  • Anonymous
    November 06, 2008
    The comment has been removed