DEV Community

yucer
yucer

Posted on

Is OOP less descriptive than FP?

Almost two years ago, there was a recent discussion topic introduced by the post Is OOP dangerous? that kept my attention. I am always interested in apparent contradictions because they are very often the source of new knowledge and development.

At that time I wrote this article as a draft and left it unpublished until today. It was intended to compare the descriptive power of OOP vs FP (and imperative vs declarative) paradigms.

To be honest, I don't feel I can invest enough time or have enough resources to make a formal comparison, but I like to look for new arguments every time so I have decided to publish it without changes, and tag it as a discussion.

So what do you think?

Do both programing paradigms have the same descriptive power?

Top comments (1)

Collapse
 
tylors profile image
Tylor Steinberger

As with most things, it depends. FP has a bunch of wordy terms, but the absolute core is composition/modularity backed by math - everything else is layered atop. The same way we use math as a precise way to describe real-life phenomenon, algebraic data types are much more precise and descriptive. OO languages that do not have sum types will never be as descriptive about data IMO, amongst many other things.

After the intro, this talk has about 30 minutes of real-world OO issues I found really useful, and some cool FP-inspired features coming to scala 3 in the last half if that interests you. youtu.be/NY2ZkcYZj54