Functional Languages are Fad

Joe Chasinga on October 09, 2018

I don't understand the functional language fad. As much as those liberal nerds despise the term IT, it is my career as much as it is theirs. And in... [Read Full]
markdown guide
 

With such concise code, where do you hide all the bugs?

Everyone knows the big consulting money is in maintenance of the monstrous monolithic shibboleths. Loquacious, garrulous verbosity is the cornerstone of How To Write Unmaintainable Code.

 

Thanks for sharing. I like your first line. I feel the same. With a functional language, you either run it right (most of the time) or not. It's harder to run with bugs or copy paste solutions.

 

I'm a fan of F#, and really enjoyed the tutorial The Book of F# by Dave Fancher. Did all my learning using Mono and Xamarin, on a Mac.

Fancher's book was much better than the other F# books I've read. I've not read Don Syme's Expert F# 4.0 book yet — reviews seem split between good and bad.

Thanks a lot for the lead. I've been very interested in learning more about F#.

 
 

It is interesting that you bring up this topic, Joe. I am an Android engineer, and am seeing a proliferation of functional-style programming with RxJava and Kotlin, etc. I think these technologies are great, but sometimes they complicate a project and slow down developers with steep learning curves.

 

It's meant to be a satire, but thanks for pointing it out. I agree with you to a point.

 

Haha. We have a lot of production code in idiomatic F# now. Love it. I was just discussing today how to serialize a union type to JSON legible by others. :)

 

Wow, you should write about it. We never get tired of hearing production story in anything functional.

 

I have sortof been doing so, though not necessary in the context of F#.

The thing with functional languages is, you can find a lot of articles and videos extolling their virtues. But they sound like the same promises every other language makes to try to get you to use them. So nobody really believes it. And on top of that you have extra things to learn like expressions-instead-of-statements, union types, immutability (this one is the same as "defensive copying" in OO, except it is the expected norm and there is language syntax sugar). So the idea does not make it through many devs built-in BS filter. I think it really takes someone you trust to tell you: "For real, there is something special about this. You should give it an honest try." For example, being told about type inference holds no comparison to typing out what you figure will be pseudocode, and realizing the compiler already knows the types. Or after a year, you come back to some code and do an epic refactor, but since you used pure functions it turns out to be easy and not risky. Southern saying: "Better felt than tell't."

So getting people to try it (like a real try, not "I gave up when it complained about a missing else.") is most of the battle. I don't know what I could say any differently from all those other videos and articles which talk it up. Just try it people, really try it. It's okay if you ultimately "get it" but still like objects or procedures better -- it's still a useful perspective to learn.

What I think is really the first enemy of learning (anything, not just functional programming) is herd mentality. When you work at a place where the most people don't view learning new things as important, your learning muscle gets atrophied. When I got an equivalent of a scoff writing something in Ocaml, I faded away.

A specific enemy to learning a functional programming is math. The author of F# for Fun and Profit stated this very nicely, but functional languages need to ease down on math. Stop campaigning lambda calculus. It's not helping, because it attracts snobs who will keep putting functional programming on higher and higher pedestal ("Oh, really, you don't know what a monad is?") and scare away new developers.

Yeah, I completely agree.

Re:math-focus. Maybe I'll change my mind one day, but this is exactly why I could not bring myself to deploy Haskell code. Even if I could be super productive with it, bringing on fresh devs seems drastically harder than something like F# because of the intertwining of category theory. I would never say this out loud, but since it is just you and me 😉, I have a theory that Haskell is more object-oriented than most OO languages. Because you kinda have to derive from the category theory objects to make canonical use of it. Whereas something like F# or OCaml or Elm, you can just pretend you are doing procedural programming + expressions + immutability + pure functions to get started and be productive. Then later notice that a lot of types use the same functions: map, bind/andThen, etc. So if you understand them once, you understand them everywhere. Then later you discover these operations are not just some dude's arbitrary contrivance, but based on provable math. mind blown. It is a great learning story IMO.

 

Got me at first too :) Though I will say, FP can make things complicated depending on how far down the rabbit hole you go. I've been working on a green field project, a little cluster of wrappers for some legacy SOAP services, using Java and Vavr - monad all the things - and I was super proud of the framework I'd built out. All exceptions handled using Try monads, all nullables handled with Options, lambda and functional interfaces used all over the place. Absolutely beautiful.

Then I had to teach it to some juniors fresh from college and some devs who - while good - don't care about pushing the envelope. If I had to do it again I really don't know whether I'd stick with FP - at least not that deep.

(For the record, they've been great at picking it up, as hard as it's been trying to explain it when I don't understand it that great myself.)

 
 

By the way....I love your JavaScript range method ;).

 

[EDIT: ok, so I took a look at your GitHub and realised what this post is. Good job!]

 

Hehe, I managed to summon all the functional crowd here!

 
 
 

Once I saw your functional snippets I knew you were joking. What's even more funny is that lots of people will believe in your article's title.

 
 

For readability, you should probably split the "two lines" as well. Counting lines might not be the best approach to compare languages...

 
 
 
 
 

I typed out a whole essay about how FP is relatively concise before I realized that this was a joke :p
Some people genuinely think like this though.

 

You may not see it as readable, but anyone remotely familiar with functional languages should understand it pretty quickly.

 
code of conduct - report abuse