Why RavenDB Isn’t Written in F#, or: the Cost of the Esoteric Choice
F# would lead to a lot more complexity than C#, reduced participation in the community, harder to find developers and increased costs all around. Here's why.
Join the DZone community and get the full member experience.Join For Free
in a recent post , a commenter suggested that using f# rather than c# would dramatically reduce the code size (measured in line numbers).
my reply to that was:
f# would also lead to a lot more complexity, reduced participation in the community, harder to find developers and increased costs all around.
and the data to back up this statement:
|c# developers||f# developers|
nitpicker corner: now, i realize that this is a sensitive topic, so i’ll note that this isn’t meant to be a scientific observation. it is a data point that amply demonstrate my point. i’m not going to run a full bore study. and yes, those numbers are about jobs, not people, but i’m assuming that the numbers are at least roughly comparable.
the reply to this was:
you have that option to hire cheaper developers. i think that the cheapest developers usually will actually increase your costs. but if that is your way, then i wish you good luck, and i accept that as an answer. how about "a lot more complexity"?
now, let me try to explain my thinking. in particular, i would strongly disagree with the “cheapest developers” mentality. that is very far from what i’m trying to achieve. you usually get what you pay for, and trying to save on software development costs when your product is software is pretty much the definition of penny wise and pound foolish.
but let us ignore such crass terms as money and look at availability . there are less than 500 jobs for f# developers (with salary ranges implications that there isn’t a whole lot of f# developers queuing up for those jobs). there are tens of thousands of jobs for c# developers, and again, the salary range suggest that there isn’t a dearth of qualified candidates that would cause demand to raise the costs. from those numbers, and my own experience, i can say the following.
there are a lot more c# developers than there are f# developers. i know that this is a stunning conclusion, likely to shatter the worldview of certain people. but i think that you would find it hard to refute that. now, let us try to build on this conclusion.
first, there was the original point, that f# lead to reduced number of lines. i’m not going to argue that, mostly because software development isn’t an issue of who can type the most. the primary costs for development is design, test, debugging, production proofing, etc. the act of actually typing is pretty unimportant.
for fun, i checked out the line count numbers for similar projects (ravendb & couchdb). the count of lines in the raven.database project is roughly 100k. the count of lines in couchdb src folder is roughly 45k. couchdb is written in erlang, which is another functional language, so we are at least not comparing apples to camels here. we’ll ignore things like different feature set, different platforms, and the different languages for now. and just say that an f# program can deliver with 25% lines of code of a comparable c# program.
note that i’m not actually agreeing with this statement, i’m just using this as a basis for the rest of this post. and to (try to) forestall nitpickers. it is easy to show great differences in development time and line of code in specific cases where f# is ideally suited to the task. but we are talking about general purpose usage here.
now, for the sake of argument, we’ll even assume that the cost of f# development is 50% of the cost of c# development. that is, that the reduction in line count actually has a real effect on the time and efficiency. in other words, if an f# program is 25% smaller than a similar c# program, we’ll not assume that it takes 4 times as much time to write.
where does this leave us? it leave us with a potential pool of people to hire that is vanishingly small. what are the implications of writing software in a language that have fewer people familiar with it?
well, it is harder to find people to hire. that is true not only for people that your hire “as is”. let us assume that you’re going to give those people additional training after hiring them, so they would know f# and can work on your product. an already steep learning curve has just became that much steeper. not only that, but this additional training means that the people you hire are more expensive (there is an additional period in which they are only learning). in addition to all of that, it will be harder to hire people, not just because you can’t find people already experienced with f#, but because people don’t want to work for you.
most developers at least try to pay attention to the market, and they make a very simple calculation. if i spend the next 2 – 5 years working in f#, what kind of hirability am i going to have in the end? am i going to be one of those trying to get the < 500 f# jobs, or am i going to be in the position to find a job among the tens of thousands of c# jobs?
now, let us consider another aspect of this. the community around a project. i actually have a pretty hard time finding any significant f# oss projects. but leaving that aside, looking at the number of contributors, and the ability of users to go into your codebase and look for themselves is a major advantage. we have had users skip the bug report entirely and just send us a pull request for an issue they run into, others have contributed (significantly) to the project. that is possible only because there is a wide appeal. if the language is not well known, the number of people that are going to spend the time and do something with it is going to be dramatically lower.
finally, there is the complexity angle. consider any major effort required. recently, we are working on porting ravendb to linux. now, f# work on linux, but anyone that we would go to in order to help us port ravendb to linux would have this additional (rare) requirement, need to understand f# as well as linux & mono. any problem that we would run into would have to first be simplified to a c# sample so it could be readily understood by people who aren’t familiar with f#, etc.
to go back to the beginning, using f# might have reduce the lines of code counter, but it wouldn’t reduce the time to actually build the software and it would limit the number of people that can participate in the project, either as employees or open source contributors.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.