DEV Community

Discussion on: Do the SOLID principles apply to Functional Programming?

Collapse
 
patferraggi profile image
Patricio Ferraggi

Hey Christian how are you? Thank you very much for that answer. It really have me something to think about. I never thought about the case of the visitor pattern, I am gonna have to check it better before my next article. I did saw the similarities you mentioned on the strategy pattern and the observer pattern, though in functional programming the benefits of the strategy pattern are much easier to achieve due to first class functions. I also see some similarities between function composition and the composite pattern. I definitely believe that a lot of the design patterns were created to give oop languages the flexibility that functional languages get for free without losing the control over data and state (at least in theory ahaha)

Collapse
 
hugecoderguy profile image
Christian Kreiling

Doing great, you've had me thinking about OOP design patterns over the last few days. I think we're saying the same thing wrt the strategy pattern; it's a means of taking some functions and composing their inputs & outputs through a centralized code module, which is what all programs written in an FP language look like. What similarities do you see between Function Composition and Composite Pattern? I see the Composite Pattern more as a means of representing a tree structure in a strongly-typed OOP language, is this what you mean when you say Composite Pattern?
Ooh, I really appreciate your observation "a lot of the design patterns were created to give oop languages the flexibility that functional languages get for free without losing the control over data and state." I've been trying to put that into words for awhile now