Skip to main content

A, B , C & now F# programming language

F# is derived from the ML family of languages, part of the functional programming language tradition. However, F# is not simply a functional language: it is a multi-paradigm langauge that attempts to capture the best of both functional and object-oriented programming in the context of .NET. Furthermore, even when used as a purely functional language F# is remarkable for the sheer power of the libraries and tools available through .NET.

The distinctive features of all ML-family languages are strong static type checking, excellent type inference, lightweight and typesafe function types, safe and syntactically convenient discriminated unions. These core work together to allow for succinct yet efficient solutions to many programming problems, and repeatedly permit common patterns of coding to be abstracted very easily.

One way of looking at it is that the purpose of F# is to solve all of the 7 major problems described in Wadler's classic paper Why no one uses functional languages: Libraries, Portability, Availability, Packagability, Tools, Training and Popularity. Of these, F# solves the issues of libraries (by immediately giving high-quality, no-wrapper access to hundreds of .NET libraries), portability (the .NET bytecode is portable, e.g. the Mono project provides an implementation for many platforms), packagability (.NET assemblies are an excellent packaging mechanism) and tools (.NET tools for other languages nearly always work with F# as well). The remaining issues are partly solved by the fact that F# has a core design similar to that of OCaml, a popular functional language implementation for which a good amount of training material is available, and also that huge amounts of excellent training material for the .NET platform is available on the web.

In more detail, the aims of F# are as follows:

  • To implement the core features of an ML programming language on the .NET platform, focusing on language interoperability via typed compilation, and to provide the an ML implementation that can co-exist as a partner language in a multi-language setting ;

  • To bring the benefits of .NET and ML-style programming to the scientific, engineering and high-performance computing communities. This also provides a setting where we can write truly significant applications in an ML-like language, thereby enabling the research community to identify and solve the remaining issues that inhibit the uptake of modern languages in the context of these software ecosystems.


There are several key application areas for a language like F# on the .NET platform. In particular, such languages excel at mathematically-oriented programming, and, given the right libraries and visualization tools, a range of scientific and engineering tasks as well. These languages are also well known to be extremely powerful when used to implement sophisticated symbolic analyses such as hardware verification, software verification, optimization, machine learning and compilation.

You can read about many applications of F# on Don Syme's blog.

The minimal technical requirements for a powerful scientific and data-intensive .NET programming language are as follows:

  • High performance

  • Succinctness

  • Simplicity

  • Interactive scripting and visualization

  • A rich developer experience (intellisense, codesense, debug, tools)

  • Support for .NET component development

  • Easy, efficient access to .NET libraries

  • Alignment with key for emerging technical trends such as multi-core computing, web services and data-oriented meta-programming.

Here are some of the things that make F# highly distinctive in this arena:

  • Its inherent technical strengths as a multi-paradigm programming language, and in particular the added productivity benefits of functional programming.

  • The use of type inference and automatic generalization to achieve both succinctness and performance.

  • The F# toolset for interactive visualization and development

  • Its support for LINQ and LINQ-style meta-programming.

  • The support of Microsoft Research for a credible, stable reputation and as a focal point for the F# community and as a key source of high-impact users at Microsoft.

  • The inherent importance of functional programming in the emerging multi-core world.

F# is, technically speaking, neutral with respect to concurrency - it allows the programmer to exploit the many different techniques for concurrency and distribution supported by the .NET platform. However, functional programming is one of the primary known techniques for minimizing, tracking and isolating the use of mutable state, essential for emerging techniques such as software-transactional-memory.

F# can directly use multi-core programming libraries such as ParallelFX. F# also includes language and library support for asynchronous workflows, a technique to write reactive programs and asynchronous message passing agents in a natural and compositional style.

One of the striking features of F# is its combination of dynamic and static features. For example, F# Interactive provides a strikingly powerful dynamic compilation environment, where dynamically entered code is executed using the full performance power of high-quality native code.

Another key feature of dynamic languages is succinctness. As with previous versions of ML, F# manages to be as succinct as many dynamic languages through its use of type inference, but like-for-like computationally-intensive samples will typically execute faster than other dynamic language implementations.

F# permits the use of other dynamic techniques such as a universal 'object' type, runtime code generation, runtime inspection of the properties of values and the runtime analysis of type parameters.

F# doesn't share all the features of dynamic languages. For example, it is not yet easily hosted inside other applications. At a language level, some operations characteristic of dynamic languages are not permitted. Likewise, it doesn't directly target the Dynamic Language Runtime, though may do so in the future.


"ML" is a language design that has had several manifestations, from Edinburgh ML to Standard ML and through to the current SML '97 and OCaml languages. F# follows the tradition of the Caml design group who seek a balance between stability and innovation. Both F# and OCaml use a simple, elegant core language and add interesting extra features. For the past several years, Ocaml has been a de-facto standard in the applied ML programming. As such, F# takes the design of core OCaml as a starting point, but combines the enormous strengths of the core OCaml language with those of .NET.


LINKS

  1. http://caml.inria.fr/ - The CAML Language
  2. http://research.microsoft.com/fsharp/fsharp.aspx




Comments

Popular posts from this blog

PDCA & SCRUM (or Agile); Why is it important?

The PDCA (Plan DO Check Act) cycle was made popular by Dr. W. Edwards Deming. This is a scientific cyclic process which can be used to improve the process (or product). This is cyclic in nature and usually time boxed. Plan  This is the first stage of the process. During this step the team discusses the objectives, the process and the clear conditions of exit (conditions of acceptance). This stage sets the measurable and achievable goals for the team. DO Team works together to achieve the objective set in the planning phase. Team works with the set of agreed process. Check Once the implantation is done team regroups and verifies the output and compares it to the agreed conditions of acceptance decided during the planning phase. The deviation, if any, is noted down. ACT If any deviation in planned tasks is observed during the Check stage, a root cause analysis is conducted. Team brainstorms and identifies the changes required to prevent such deviations in future. Team also

Why is potentially shippable product quality important

Agile teams work in iterations. During this period, they are supposed to work on product increments which can be “delivered” at the end of iteration. But how you know that the correct product was delivered? Many teams have different kinds of acceptance criteria and Definition of Done (DoD). But in many cases, this “done” is not the real “done” there might be some testing pending, some integration or review pending or anything else which prevents the actual use of the product increment. Many of these teams will need additional iterations to finish hardening their products. Many teams will implement different types of “gates” or approval steps to move to next stage. The free flow of product will be interrupted. They might end up doing mini waterfall within their agile process. Many don’t even realize this. This results in poor quality and requires additional effort to “harden” the product. Potentially Shippable Product increment The acceptance criteria and DoD should be modified

Product Backlog: Should you write everything in user story format?

I like user stories a lot. They help everyone talk the same language and results in a better product. User story alone does not constitute product requirement. User story is supposed to be a place holder for discussion which should happen between the team, Product Owner and the customer. This discussion result in a common understanding which along with the user story content is the product requirement. This format captures the essence of requirement without confusing the readers User Story is only one of the many different ways in which requirements can be represented. This is not mandatory in any Agile “process”. But many have made this mandatory. I have seen many spending countless hours trying to write the requirements in user story format when they could have easily written that in simple one-line sentence in few minutes.   I have seen team members refusing to even discuss the requirement until product owner rewrote the requirement in user story format. Once I