BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Object Oriented Design Principles and Functional Programming

by Jan Stenberg on Mar 20, 2014 |

Object-oriented programming has a lot of well-established design principles, such as the SOLID principles, but when moving towards functional programming many developers don’t know how to use their existing design skills, Richard Warburton recently stated in a presentation.
On the same subject, Mark Seemann in a recent blog post writes that if you take the SOLID principles to their extremes, you arrive at something that makes functional programming look quite attractive.

Richard, a member of the London JCP Committee, in his presentation describes the SOLID principles as one example of well-established object oriented programming design principles, identified by Robert C. Martin in the early 2000s, and looks at each of the five principles trying to find a functional equivalent or at least something related on the function side.
Richards experience is that although many developers don’t know how to use their existing design skills in functional design, functional programming can often help in implementing the SOLID principles and also that a functional mindset can actually help in achieving one important aspect of object-orientation, encapsulation.
Richard’s conclusion is that all the solid principles have a functional equivalent. Existing design patterns don’t need to be thrown away; instead they can be improved by making them simpler or cleaner, or by utilizing existing knowledge in a simplified way.

Mark, a software architect and independent advisor, in his experience has found that the SOLID principles can lead to a style of design that makes functional programming quite attractive.
When applying two of the SOLID principles, Single Responsibility Principle (SRP) and Interface Segregation Principle (ISP), you often end up having a code base with many fine-grained interfaces and classes each having a single method.
Mark’s conclusion is that if applying SOLID principles repeatedly leads to these small classes with a single method, then the functionality can be modelled as behaviour with data, at which point it may be time to move to a functional programming language like F#.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT