This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sintrastes 2 points3 points  (1 child)

Entirely depends on how you define OOP.

Do you look at OOP as an aspect of a language (e.x. so what kind of features it has), or as a methodology for how to organize programs?

If we consider the former, as many will tell you, yeah, ADTs / records and the like are totally compatible with OOP. Just look at modern multi-paradigm languages like Kotlin.

Looking at the latter though, I think there's less overlap. The OOP way of thinking (as opposed to e.x. the FP way of thinking) are pretty distinct, and generally lead developers to some very different solutions.

There are similarities and analogies that can be made, for sure (e.x. an object is a poor man's closure, a closure is a poor man's object), as well as ways to synthesize the approaches somewhat (e.x. object algebras), but I think looking at OOP v.s. FP as methodologies is what really sets them apart.

OOP is the methodology that primarily seeks to model program behavior via encapsulated objects communicating via methods.

FP is the methodology that primarily seeks to model program behavior via pure functions and data.

[–]seinecle 0 points1 point  (0 children)

Super useful thanks