Goodbye C++. Hello F#?

By Graeme Burton
11 Jul 2014 View Comments
Swift programming language from Apple

Computer giants such as Apple and Microsoft are leading a shift in programming language architecture that may soon see established development languages, such as C, C++, C# and Java, pushed aside in favour of "functional programming languages".

"Functional programming is a coding style that emphasises ideas such as composition from simple building blocks, immutability of data structures and the use of functions as data," according to developer Luke Hoban, a program manager at Microsoft. Many of these features, he adds, have already been absorbed into Microsoft's developer tools.

Further reading

These include F#, which has been part of the .NET Framework for the past seven years. "Originally designed and developed by Don Syme in Microsoft Research's labs in Cambridge, England, F# draws from other functional languages, notably Lisp, Haskell and ML-derivative OCaml," adds Hoban.

Until recently, despite Microsoft's developments, functional languages were largely the preserve of computer science. However, functional programming principles and languages are now coming into their own due to the rise of cloud and mobile computing.

Furthermore, Microsoft recently open sourced F# – under an Open Source Initiative-approved licence – with the establishment of the F# Software Foundation. F# now runs on Linux, MacOS, Android, iOS and Windows, as well as on HTML 5.

One of the key reasons for the gathering shift towards functional programming languages in everyday applications is their mathematical approach, with results that depend only on their inputs and not on the program state, ie pure mathematical functions. One of the benefits ought to be more predictable programs – and fewer bugs and security flaws in resulting code.

While object-oriented, Apple's recently announced Swift programming language, designed to replace Objective-C, also supports some functional programming styles – some commentators have likened it to Clojure. When Apple unveiled the new development environment this summer, senior vice president Craig Federighi claimed that it "defines away large classes of common programming errors; they're just not possible".

In particular, functional or functional-ish programming languages such as F# and Swift are being seen as ideal for endpoint devices in a world dominated by mobility and cloud computing. In particular, F# has seen some uptake in financial services, where new ideas are often adopted first due to the resources available in the sector.

Companies such as Facebook have also dipped their toes into the water, adopting functional programming in an app to update the news feed for its Apple iOS client. According to Facebook engineer Adam Ernst, the approach greatly increased reliability and, hence, reduced the support overhead.

Constantly updating, Facebook's news feeds are more complex pieces of code than they appear to the user because of the need to minimise latency, while taking into account each update as and when they happen.

Reader comments
blog comments powered by Disqus
Windows 10 - will you upgrade?

Microsoft has made an early version of Windows 10 - its next operating system - available for download. The OS promises better integration and harmonisation across platforms, including mobile and desktop. Will your business be upgrading?

35 %
31 %
14 %
20 %