Remix.run Logo
epolanski 6 hours ago

Many great design patterns have come from OOP and have found their home in functional languages or libraries.

Dependency injection has to be the most successful one, but there's at least another dozen good ideas that came from OO world and has been found to be solid.

What has rarely proven to be a good idea instead is inheritance at behavior level. It's fine for interfaces, but that's it. Same for stateful classes, beyond simple data containers like refs.

You can even have classes in functional programming word, it's irrelevant, it's an implementation detail, what matters is that your computations are pure, and side effects are implemented in an encoded form that can be combined in a pure way (an IO or Effect data type works, but so can a simple lazy function encoding).

1718627440 2 hours ago | parent [-]

I think the opposite is true, many good patterns have been combined and are now called OOP. Most were already common before that and had another name.