r/functionalprogramming • • Nov 05 '23

Question Why is functional programming so hard

Throughout my entire degree till now, I’ve been taking OOP. Now I am in a FP course and I am struggling a lot. I understand it’s almost a total different thing. But I just failed a midterm in FP in Ocaml. I swear I could’ve solved the questions with my eyes closed in OOP. What am I doing wrong, why can’t I get a grasp of it. Any tips on how I should approach studying this.

78 Upvotes

87 comments sorted by

View all comments

Show parent comment

2

u/Neither-Acadia2395 Nov 06 '23

Many people are saying you gotta unlearn OOP and start from scratch. Is there a specific mindset I should have (not sure if I’m describing it properly), like how for gym movements they teach you cues to have a better mind-muscle connection. Is there something similar where I should be approaching a problem with a specific mindset.

3

u/WystanH Nov 06 '23

gotta unlearn OOP and start from scratch

Rather, I would say that you to play to the strengths of the language you're using. Every programming language excels in certain areas. A functional programming language should excel at functional programing and probably suck at procedural programming. Let the language, or perhaps style, guide the coding.