Key takeaways
|
In April, for the second time, fsharpWorks organized the F# community survey. Over 600 developers completed the survey in 2016 (which is 15% more than in 2015). The survey provides an insight into the brains of the F# community. In this article, I'll summarize some of the results.
You can also explore the complete results of all 33 questions from the survey on your own and share interesting finds in the comments.
F# has been around for a number of years now, but the way developers use it has been changing. There are many new open-source libraries that make F# appealing in different domains and current users also appreciate different aspects than the early adopters.
What are the reasons why developers choose F# for their projects in 2016? How are they using F# and what are the application domains where F# excels? What are the new trends since the previous year? And what are the biggest challenges for the future?
Who are F# developers
I love what I see in the F# community. It's a unique thing to be a part of and it felt very welcoming once I decided to take the first step. I only hope that we can reach out to those that haven't taken a first step yet.
The survey respondents are generally experienced software developers, with 64% of respondents having 10 years of experience programming (in any language). Over 81% of F# developers also use C#, but there is an increasing number of F# respondents who program client-side web applications (38% also use JavaScript and 9% also use TypeScript).
Most of the F# developers have Windows background and 90% use Windows as one of their platforms, but there is a growing number of non-Windows F# users too. In particular, 25% of F# developers (also) use Mac and 25% (also) use Linux. As there was a lot of development on cross-platform F# since the last year, I'll return to the topic of cross-platform F# development below.
Tooling, business, web and data
I often hear people stating that "F#, that's only good for calculations right?" I think those people are often scared away by the fact that many examples are from that world.
In the early days, F# had a reputations as a language good for financial and computationally-heavy applications. This is perhaps due to the some of the early high-profile adopters, but the current numbers show different results.
The largest number of respondents (45%) said that they use F# for utilities and tools. This reflects the fact that F# supported interactive development with REPL (read-eval-print-loop) since the first version. A number of respondents use F# with one of the lightweight editors to get small coding tasks done using the REPL without much overhead.
Aside from the REPL environment, the F# ecosystem also comes with a number of powerful libraries. In particular, random testing library (FsCheck) and a library for writing build scripts (FAKE) feature prominently in the list of the most popular tools (below). Scripting and writing build scripts and tests is also one of the low risk ways of getting started with F# as listed on the F# for Fun and Profit web site.
Following utilities, the next four application areas (between 21% and 17%) cover a wide range of topics including data analytics, web applications and business applications.
F# is used for both commercial and non-commercial web sites and applications (18% and 14%) and the web theme appears in other answers of the survey. The Suave web server is one of the most popular F# libraries, the Suave Music Store tutorial has been mentioned as a popular F# resource and over 38% of F# developers also use JavaScript.
F# is still popular for statistics and data analytics (21%). The FsLab package has been mentioned a number of times in the most popular libraries (although it did not make it to the top 5). Many of the F# developers are also familiar with wider range of data science and statistical tools and languages - 19% respondents also program in Python and 5% use the R language, which can be integrated with F# using the R type provider.
Why F# developers choose F#
[The F# community should] better show the benefits in real-Âworld projects, which might not be always the most exciting (…) code, but ordinary business functionality in which F#'s domain modeling power really excels.
The biggest benefits reported by the respondents of the F# survey are highly relevant to the two of the popular applications of F#. In the chart in the previous section, F# is used for both algorithm-heavy and mainstream business applications (both by 17% of respondents). In algorithm-heavy applications, correctness is of paramount importance and mainstream business applications greatly benefit from F#'s support for domain modelling and making illegal states unrepresentable.
Domain modelling in F# is done using algebraic data types (also known as discriminated unions) which are one of the most popular F# features in both editions of the survey (65% of developers included them among their favorite features). Again, the F# for Fun and Profit site hosts an introduction to domain modelling with F# types.
The perceived benefit of correctness when writing F# code can be likely linked to the other popular F# language features. Immutability by default is the most prominent one (included by 78% of respondents), shortly followed by type inference (69%) and the "piping idiom" (also 69%).
Both immutability and the "piping idiom" appear in a restricted form in LINQ in C#. The IEnumerable type is typically used as immutable and the F# pipe operator |> serves similar purpose as method chaining in C#. In F#, both of the concepts are used not just when processing collections, but more generally when designing software. You can learn more about the principles in the Thinking functionally series. Many popular libraries are built around the "piping idiom" including MBrace, which uses it for composing cloud computations and XPlot, which uses the pipe operator for configuring features of charts.
Perhaps surprisingly, F# type providers were mentioned as a favorite feature by less than half of the respondents (45%), although one of the most popular libraries is F# Data, which implements type providers for working with XML, JSON and CSV formats.
Cross-platform and tooling
One of the most recent developments in the F# community is the move towards full cross-platform support. As already mentioned, majority of F# developers still use Windows as one of their platforms, but the use of Max and Linux is growing. The percentage of F# developers who deploy their code to Linux grew from 21% to 33%, making it the second most popular deployment target after Windows. The growing interest in this area is supported by the fact that a talk Cassandra, Docker and F# Awesomeness by Alena Hall became the most watched talk out of 15 sessions of the first virtual F# conference fsharpConf.
The other area where F# is becoming more cross-platform and diverse is tooling.
This question did not allow choosing multiple editors in 2015 and so making correct comparison is somewhat difficult. However, a growing number of F# developers is not using Visual Studio as their only development environment. Most notable is the popularity of the Ionide project, which implements an F# plugin for the Atom editor and for VS Code (both being cross-platform editors). Ionide is about 1 year old and is already used by 42% of F# developers (with one or the other editor). Xamarin Studio provides an F# support on the Mac and is used by 14% of F# developers and both vim and Emacs (with F# mode) are also growing in popularity.
Powerful libraries and tools
F# can easily interoperate with the .NET ecosystem, but there is a growing number of popular tools and libraries that have been created by the community and take full advantage of the F# language. The following summary lists the libraries and tools that "made the most difference to F# developers". The number in parentheses says how many times has a library been mentioned and has been extracted from the survey results using a simple F# script that you can run or improve.
-
FAKE (86) and Paket (74) are two projects that fit in the space of tooling and utilities. FAKE lets you write powerful build scripts that do everything from generating AssemblyInfo files from RELEASE_NOTES.md to publishing NuGet packages and more. The second project, Paket, is a package manager based on
NuGet that solves a number of issues with the standard NuGet tooling. It has a separate file to "lock" versions, handles transitive dependencies etc. Both FAKE and Paket also work with C# projects and are increasingly popular in the C# community. -
F# Data (53) is a library of type providers that make it easy to access data in JSON, XML and CSV formats. The library infers types from sample documents and so you can access data with auto-complete without defining any types by hand. Although specific to F#, the library can be used from F# components of a larger .NET application. This topic is covered in a recent Pluralsight course.
-
F# PowerTools (34) and Ionide (31) are two tools that every F# developer needs to know about! F# PowerTools is a Visual Studio extension that improves colorization, adds refactoring support and more. Already mentioned Ionide projects adds F# support for Atom and VS Code.
-
Next three projects that scored highly in the survey are F# libraries solving interesting problems in three areas where F# gets used a lot. FsCheck (31), which can also be used from C#, is a random testing library that makes it easier to cover subtle corner-cases in your tests. Suave (31) is a lightweight web server with a composable API and FParsec (24) is a library for writing parsers, that is often used when creating domain-specific languages.
Learning resources
The Suave Music Store tutorial is perhaps the best tutorial I've ever seen for any language/library ever.
Aside from general statistics and popular libraries, the F# survey also asked a couple of questions about learning F# and getting information about F#. There is a lot happening in the F# community, but you need to know where to look!
-
The Suave Music Store tutorial was mentioned a number of times as an awesome learning resource. It presents a step-by-step guide developing a business web application in a functional style with the Suave web server.
-
When it comes to keeping up-to-date with F# news, over 60% of F# developers use Twitter. Follow the #fsharp hashtag to see what is happening! The second source of news (used by 58% of respondents) is regular F# Weeklymaintained by Sergey Tihon, which delivers the most important news from the F# community every Monday (since November 2012!)
-
The survey also mentions a couple of activities started by the F# Education working group of the newly founded F# Software Foundation. This includes the pilot mentorship program (expect another run in the future!), fsharpConfvirtual conference and the F# speaker program.
Looking ahead
Many of the survey answers, but also views from the outside show that the F# language has an enthusiastic community that is actively engaged, builds popular open-source tools and libraries, but also contributes major improvements to the compiler itself (see Elm-style error messages and Struct records for just two examples).
On the technical side, we can expect more development on the cross-platform side of F#. The improving support and adoption of cross-platform tooling shows that this is something that the community is actively working on. Aside from mono, which already allows many F# developers to use Linux as a target and Xamarin, for targetting iOS and Android, the next player in the cross-platform game is Microsoft's CoreCLR. Targetting CoreCLR is something that both the F# team at Microsoft and the community is looking into and I expect to see many things happening in this space over the next year.
When it comes to adoption, there is still more to be done on explaining the benefits of F# in business terms. This is one place where the F# Software Foundation can have an impact, be it through collecting testimonials or through producing solid educational materials.
The number of people working in companies where "everybody loves F#" has grown from 8% in 2015 to 14% in 2016, which is a significant improvement in just one year. Some issues for adopting F# at work remain though. In particular, companies worry about hiring and training of F# developers. This is a surprising point, because the survey shows that there is a number of enthusiastic F# developers who are not using F# as their primary language at the moment. On the training side, increasing number of F# consultancies, including fsharpWorks offer F# trainings and workshops. This suggests that better communication around F# is perhaps the most important task for supporting F# adoption among businesses. This is also an area where the F# Software Foundation and its growing list of members and sponsors can make a big difference.
About the Author
Tomas Petricek is an F# enthusiast, conference speaker and an author of “Real-World Functional Programming”. He is a partner at fsharpWorks where he provides trainings and consulting services. Tomas contributed to the development of many F# open-source libraries, but also the language itself as a contractor at Microsoft Research. He recently submitted his PhD thesis, working on the theory of context-aware programming languages.