Functional Code is Shorter

Reason #6 to Learn Functional Programming

You may have heard it before, but I'll say it again: Functional code tends to be shorter than equivalent code in non-functional languages. See this paper about a project at Erlang and their estimates of how much shorter it is than an equivalent C++ program. Spoiler: C++ is between 4 and 10 times longer than Erlang. Here is a quote:

Some concrete comparisons of source code volume have been made, as applications written in C++ have been rewritten in Erlang, resulting in a ten-fold reduction in the number of lines of uncommented source code. Other comparisons have indicated a fourfold reduction. A reasonable conclusion is that productivity increases by the same factor, given the same line/hour programmer productivity.

When measuring product quality in number of reported errors per 1000 lines of source code, the same relationship seems to exist: similar error density, but given the difference in code volume, roughly 4-10 times fewer errors in Erlang-based products.

You should learn functional programming. I'll give you many reasons, but this is just one. Reason #6 is that functional code is shorter.

If you want to learn functional programming, sign up for the Functional Programming Career Guide below.

If you liked this video, please share:

Check out the next reason: Functional Code is Simple

Read now
Eric Normand

Eric Normand

Eric Normand loves functional programming. He wants to help you thrive. He is the Chief Instigator and Fearless Leader of PurelyFunctional.tv.