"Functional Programming is all about making programming soild and robust as mathematics and should be viewed from that point"
This repository contains a collection of valuable functional programming examples discussed during the sessions by Eng. Mohammed Hammad. The aim is to provide clear and concise examples that illustrate key concepts in functional programming, making it easier for developers to grasp and apply these principles in their own projects.
You can find the complete recorded sessions via this Link
To run the examples in this repository, you will need:
- Java Development Kit (JDK) 11 or higher
- An Integrated Development Environment (IDE) such as IntelliJ IDEA or Eclipse
Clone this repository to your local machine using the following command:
git clone https://github.com/Gerges-Wageh/Functional-Programming-Sessions-Eng.Hammad.git
Navigate to the project directory:
cd Functional-Programming-Sessions-Eng.Hammad
To run the examples, open the project in your preferred IDE and execute the main class for each example. Each example is contained within its own package for ease of navigation.
In this session example we discussed an OOP style code with global states to contrast how bad the idea of global states.
In this session we introduced the pipeline concept through simple example solved once imperative and once declarative.
In this session we introduced the idea of "Funtions As Data", and illustrated how to store a function in a delegate (Functional Interface in Java) and deal with them the way you deal with data (i.e. storing them in different data structures, passing them through functions, returning them from functions).
We illustrated the concept of "Higher-Order function" via an example where we used a higher order function that accepts a function as a parameter to calculate some data internally without expose this as a separate step in the pipeline
In this session we discussed an example that may change your way of thinking about programming, the example illustrates the idea of looping over a list of functions and pumping them through the pipeline as we deal with data!
The solution constructed two pipelines, the first pumping data through a function which internally pumping a list of functions though another pipeline to apply them on the same piece of data!
This session discussed a very critical concept in functional programming which is Function Composition. We see the power of function composition in the session 6 example.
In this session we solved a huge real life business problem, an outstanding example to cover all the functional programming concepts so far. We saw how Function Composition is a powerful property to develop a testble, extendable and robust code for a very complex problem while maintaning the granularity.
In this session we discussed the concept of closures and saw the benifit of returning a function that maintaing state inside from another function.
This is the most interesting part, when you understand the whole magic, and how things work under the hood.
Special thanks to the great Eng. Mohammed Hammad for his insightful sessions on functional programming.