Quantcast
Channel: Karthik Chintala
Viewing all articles
Browse latest Browse all 5

Why F# ?

0
0

There are several languages that a developer can use. F# on the other hand is a functional programming language, giving you just what is needed to build an enterprise application.

F# is basically used to build applications that needs scientific or data analysis or to tackle complex problem solving with simple code.

Here are few reasons that you should consider programming in F#

  • Simplicity: The code that you write in F# is more cleaner than what you do in imperative programming languages(C#, Java etc). There is "no noise" such as curly braces, semicolons etc. So, the focus is on the logic that you are writing, not on the noise.

Ex: Let's see how a simple hello world program can be written in both F# and C#

image of fsharp_vs_csharp

  • Library Support: F# is part of .NET eco system. So you get all the libraries and tools that are available in .NET.

  • Write C# code in F#: Yes, you can write C# code in F# by importing the namespaces. But you've to write the code according to semantics of F#, because it won't make any sense to F# compiler to compile C# code written in F#.

Ex: The following is an example showing how you can open a Form using System.Windows.Forms namespace

//OpenawindowsformsapplicationopenSystem.Windows.Formsletform=newForm(Width=400,Height=300,Visible=true,Text="Hello World")form.TopMost<-trueform.Click.Add(funargs->printfn"clicked!")form.Show()
  • Interoperable: Whatever the code you write in F# can be used in C# language. As mentioned earlier F# is part of .NET eco system. So, you could build a component in F# and then integrate it into C# just as you would consume other third party libraries. It just works!

  • Asynchronous programming: Async programming is very easy and intutive with async expressions. Immutability is encouraged in F#, this makes multi-threading more reliable and easy.

Let me know your thoughts below.


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images