# General Discussion > General Developer Topics >  Does functional programming replace GoF design patterns?

## TechVeera

Since I started learning F# and OCaml last year, I've read a huge number of articles which insist that design patterns (especially in Java) are workarounds for the missing features in imperative languages. One article I found makes a fairly strong claim:

Most people I've met have read the Design Patterns book by the Gang of Four (GoF). Any self respecting programmer will tell you that the book is language agnostic and the patterns apply to software engineering in general, regardless of which language you use. This is a noble claim. Unfortunately it is far removed from the truth.

Functional languages are extremely expressive. In a functional language one does not need design patterns because the language is likely so high level, you end up programming in concepts that eliminate design patterns all together.

The main features of functional programming (FP) include functions as first-class values, currying, immutable values, etc. It doesn't seem obvious to me that OO design patterns are approximating any of those features.

Additionally, in functional languages which support OOP (such as F# and OCaml), it seems obvious to me that programmers using these languages would use the same design patterns found available to every other OOP language. In fact, right now I use F# and OCaml every day, and there are no striking differences between the patterns I use in these languages vs. the patterns I use when I write in Java.

Is there any truth to the claim that functional programming eliminates the need for OOP design patterns? If so, could you post or link to an example of a typical OOP design pattern and its functional equivalent?

----------


## wolle

You posted the same question here and got many high-rated replies,

https://stackoverflow.com/questions/...esign-patterns

But it was 13 years ago, so maybe you have forgotten?

----------


## Steve R Jones

> You posted the same question here and got many high-rated replies,
> 
> https://stackoverflow.com/questions/...esign-patterns
> 
> But it was 13 years ago, so maybe you have forgotten?


Actually, it was ->   13 years, 11 months ago

but whose counting.   GOOD CATCH.

----------


## VictorN

> Actually, it was ->   13 years, 11 months ago
> 
> but whose counting.   GOOD CATCH.


 :Big Grin:  :big grin:  :Big Grin:  :big grin:

----------


## wolle

> Is there any truth to the claim that functional programming eliminates the need for OOP design patterns? If so, could you post or link to an example of a typical OOP design pattern and its functional equivalent?


If you accomplish a certain functionality according to the OO paradigm using OO  patterns, you can achieve the same with the FP paradigm using FP patterns. So in this sense, it is true that FP eliminates the need for OO patterns. 

One should not even attempt to use OO patterns in FP. It is because the patterns of a paradigm represent good coding in that paradigm. And using alien patterns most likely violates the paradigm resulting in bad code. So when doing OO, use OO patterns and when doing FP, use FP patterns.

Here is a talk on the topic focusing on FP patterns,

https://www.youtube.com/watch?v=srQt1NAHYC0

----------

