Skip to Content
Object-Oriented vs. Functional Programming
book

Object-Oriented vs. Functional Programming

by Richard Warburton
October 2015
Intermediate to advanced
44 pages
52m
English
O'Reilly Media, Inc.
Content preview from Object-Oriented vs. Functional Programming

Chapter 4. Conclusions

Object-Oriented vs. Functional Languages

In this report, we’ve covered a lot of ways in which ideas from functional programming relate to existing object-oriented design principles. These idioms aren’t as different as a lot of people make them out to be. Definitely functional programming emphasizes the power of reuse and composition of behavior through higher-order functions. And there’s no doubt that immutable data structures improve the safety of our code. But these features can be supported in an object-oriented context as well, the common theme being the benefits that be achieved are universal to both approaches. We’re always seeking to write code that is safer and offers more opportunity for composing together behavior in a flexible manner.

Functional programming is about a thought process. It’s not necessarily the case that you need a new language in order to program in a functional style. Some language features often help though. The introduction of lambda expressions in Java 8 makes it a language more suited to functional programming. While object-oriented programming traditionally has been about encapsulating data and behavior together, it is now adding more support for behavior on its own thanks to ideas from functional programming.

Other languages such as Scala or Haskell take functional ideas further. Scala offers a mix of both functional and object-oriented programming facilities, whilst Haskell focuses purely on functional programming. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781492048138