Hacker News new | ask | show | jobs
by pcwalton 5074 days ago
My favorite illustration of the reason why OO and FP each have their strengths is the expression problem: http://en.wikipedia.org/wiki/Expression_problem

Briefly, functional programming is good at one use case (adding new operations over the data type) and weak at one use case (adding new data type variants), while OO is the opposite (adding new data type variants is easy, while adding new operations is not). You have to choose between OO and FP based on which notion of extensibility is more important to you for the problem at hand (unless you use the relatively exotic solutions of multimethods or the generics trick that Wadler originally proposed).

My takeaway is that OO and FP both have their time and place, and the pragmatic programmer will learn when to use one or the other instead of choosing one camp and bashing the other side.