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

1

u/SolaceFiend Nov 07 '23

Objects are instances of a Class, therefore, in this case, OOP really is about the Class more than the Object, since an object is just an instantiated instance of that class to start with. If you say it's about the object, which object of that class? With which situationally stored data in said object is OOP about, as opposed to the class (i.e. blueprint) from which it is constructed?

3

u/FalseRegister Nov 09 '23

Again, there is OOP without class-based structures. See Javascript's prototypes for instance.

Classes are popular but not the only way to express the template or type of an object.

Why do you think the name is OBJECT Oriented Programming and not Class Based Programming? ;)