Learn Functional Programming Before Java Lambdas, Functional Interfaces

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:

  1. What is functional programming?
  2. What is difference between functional programming and object-oriented programming?
  3. Function as a first-class citizen in FP Vs Objects as first-class citizen in OOP.
  4.  All about functions, e.g., First-class functions, higher order functions, pure functions. 
  5. Lambda Expressions 
  6. Closures
  7. Currying (recall adapter pattern in OOP)
  8. Lazy evaluations (Haskell – a classical example of delayed evaluation language)
  9. Continuations
  10. 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!

Learning Functional Programming without Growing a Neckbeard

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
http://www.ibm.com/developerworks/java/library/j-ft1/index.html

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

Teach a Kid Functional Programming and You Feed Her for a Lifetime

Resources for Getting Started With Functional Programming and Scala

Ajitesh Kumar
Follow me

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com
Posted in Programming. Tagged with .

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *