OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts.
I think they can be used in a complementary manner. One area where functional thinking can be a benefit can be in code that is tested with a lot of mocks. Instead of having a bunch of objects that mutate state and that need to be mocked out, model that part of the program as a series of pure function transformations of data. It will be much easier to test and reason about.
Re:Ask HN: Relationship between OO and functional programming?
by honua on Tuesday May 31, 2016 @04:28PM
(#11809932)
Tiny request -- can you indicate that the line following the link is a quote? I wasn't sure if that was from the 'tweet' or if that was your interpretation/summary of it
OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts.
I think they can be used in a complementary manner. One area where functional thinking can be a benefit can be in code that is tested with a lot of mocks. Instead of having a bunch of objects that mutate state and that need to be mocked out, model that part of the program as a series of pure function transformations of data. It will be much easier to test and reason about.