←back to thread

296 points gyre007 | 1 comments | | HN request time: 0.353s | source
Show context
flowerlad ◴[] No.21283724[source]
Functional programming is not new, it has been around for many decades. The reason it didn't catch on is because it doesn't map very well to how our brain works. Human brains are object oriented, so OOP is very easy to grasp.

The real question is, why are people now taking a second look at functional programming. And the answer is Moore's law. Moore's law is coming to and end, and CPUs are not getting faster. Instead they are adding more and more cores. To take advantage of lots of cores you need concurrency. OOP is not very concurrency-friendly because objects have state, and to avoid corrupting state in a multi-threaded environment you need locks, and locks reduce concurrency. Functional programming doesn't have state, so you don't need locks, so you can get better concurrency.

replies(4): >>21283758 #>>21285545 #>>21286055 #>>21286061 #
yogthos ◴[] No.21285545[source]
That's utter rubbish. My team has been working with Clojure for close to a decade now. We regularly hire coop students from university, and none of them have ever had problems learning functional programming. It typically takes around a couple of weeks for a student to become productive and start writing useful code. The only people I've ever met who say that FP doesn't map to the way our brains work are people who're deeply invested in imperative style and never tried anything else.

The reasons for the imperative style being dominant are largely historical. Back in the day we had single core machines with limited memory and very slow drives. Imperative style and mutability makes a lot of sense in this scenario. Today, the problem of squeezing out every last bit of performance from a single core is not the most interesting one. And we're naturally seeing more and more FP used in the wild because it's a better fit for modern problems.

replies(1): >>21285714 #
flowerlad ◴[] No.21285714[source]
I think you can do better than calling something you disagree with “rubbish” because your team didn’t have problems with it.

Here’s an example of people finding functional programming unnatural, maybe you can leverage your experience to explain why he is wrong:

Functional Programming Is Not Popular Because It Is Weird https://probablydance.com/2016/02/27/functional-programming-...

replies(3): >>21286912 #>>21286947 #>>21288530 #
1. iLemming ◴[] No.21288530[source]
Have you actually tried it? I dunno, after using Clojure for a while I realize now - there's nothing weirder than having to dig into deep, nested hierarchies of Java classes. I simply don't understand anymore people who willingly write that kind of code and even claim to be happy and productive.