As Java 8 got out-of-door, I wanted to quickly get on board with understanding and writing Lambda expressions and functional interfaces. But it was not easy like previous Java versions. And, the primary reason is the different programming paradigm one needs to understand in order to make use of Java Lambdas and functional interfaces concepts. And, this programming paradigm is functional programming. In one of the pages on functional programming (FP) I came across, it spoke about the change in thinking/mindset one, especially OOP developer, needs to bring in order to do a great job with functional programming. This is primarily because in OOP world, objects are first class citizens whereas in FP world, functions are fist-class citizens. And, that is a BIG change in itself.
Following is listed some key fundamentals which needs deeper understanding to rock and roll in the world of FP:
- Functions as first-class citizens rather than objects (as in OOP)
- Working with immutable (final in Java) data; Avoid mutable state
- Expressions instead of Statements (as in OOP)
- Understanding functional types
- Understanding recursive programming and its significance
Mastering Java 8 features such as Lambda expressions & functional interfaces would require developers to have a clear understanding on some of the following topics in relation with FP:
- What is functional programming?
- What is difference between functional programming and object-oriented programming?
- Function as a first-class citizen in FP Vs Objects as first-class citizen in OOP.
- All about functions, e.g., First-class functions, higher order functions, pure functions.
- Lambda Expressions
- Currying (recall adapter pattern in OOP)
- Lazy evaluations (Haskell – a classical example of delayed evaluation language)
- Pattern Matching
As I understood above, I started digging web to learn FP concepts first and then move on to Java Lambdas and functional interfaces packages such as java.util.function. Following presents a list of bookmarks on some good pages on functional programming. These pages were found to be presenting different aspects of Functional Programming in an easy-to-understand manner such that I could get a good grasp on concepts to get started on Java Lambdas and functional interfaces. Hope these pages would be helpful for fuctional programming rookies.
Functional Programming For The Rest of Us
If you wanted to read just one article on FP, I would recommend none other than this one. One of the finest article I have read on functional programming. Goes like a breeze! Enjoy!
Functions as First-Class Values
Describes functions as first-class entity (having first class status) in the light of following characteristic of a first class citizen withing a programming paradigm with detailed examples:
- Ability to bind an identifier (or name) to the value
- Store the value in a data structure, such as a list
- Pass the value as an argument in a function call
- Return the value as the value of a function call
Real World Functional Programming
This is a book on F# and functional programming. Whethar or not, you want to know about F#, several pages could help you get greater insights into FP.
IBM Technical Library for Functional Programming
Presents links to various different pages on functional programming concepts. Some of the following are pretty interesting reads to learn about functional programming:
Functional thinking: Thinking functionally, Part 1
What is Functional Programming?
Presents description on the Wikipedia definition of Functional Programming. Also, describes key characteristics of functional programming
– Fist-class functions
– Higher-order functions
– Pure functions
- Beta Distribution Explained with Python Examples - September 24, 2020
- Bernoulli Distribution Explained with PythonExamples - September 23, 2020
- K-Nearest Neighbors Explained with Python Examples - September 22, 2020