Wednesday, 10 February 2016

Time to embrace multiparadigm languages

I enjoyed reading Ben Walpole’s piece on Linkedin, In Defence of OOP. Ben is absolutely right, object oriented programming (OOP) is getting a bad press in the shadow of the latest golden hammer, functional programming. What I believe Ben is really saying is that you should use the right tool for the right job. When you have a new golden hammer everything may look like a nail, but it isn’t.

Often you need more than one tool for a job. Programming languages are just tools and many of them complement each other when used together. Furthermore, OOP and functional programming work together on both the JVM (Java Virtual Machine) and the .Net platform in the form of Java and Scala and C# and F# respectively. The JVM and .Net allow you to run OOP code and functional code in the same program. The C# language has traditionally been an object oriented language and is gradually adopting more and more functional features.

This got me thinking back to where my career began with C++. A lot of fuss was made about C++ not being an object orientated language, especially when Java came about. C++ was originally called C with class and that describes very well where it started. Then over the years various other paradigms were introduced and C++ became a true multi-paradigm language. With C++ you can write, compile and link object oriented code and functional code in the same program. It’s all just C++.

It’s time to stop thinking of ourselves as object oriented programmers or functional programmers, embrace multi-paradigm languages and think of ourselves as multi-paradigm programmers with multiple tools in our ever growing programming tool box.

No comments:

Post a Comment