SlideShare a Scribd company logo
1 of 56
Functional Programming in Java
Narendran, S S
THERE IS A CHANGE IN “THE CLIMATE” TO CHANGE OUR WAYS
“LAMBDAS IN JAVA 8 IS NOT FOR WHAT
THEY CAN DO, IT IS ABOUT HOW WE
WRITE PROGRAM”
IT ENABLES FUNCTIONAL PROGRAMMING, IT ADDS A NEW
NUCLEOTIDES IN THE DNA OF JAVA.
Structural Reflective
Object
Oriented
Functional &
Declarative
Imperative Concurrent Generic
My FP Inspirations!!!
Douglas Crockford Mario Fusco
Brian Goetz Venkat Subramaniam
“JavaScript: The Good Parts”
Book Author
“Java 8 in Action” Book Author
Java Specification Lead
“Java Lambdas is one of the
specificaiton”
“Functional Programming in
Java” Book Author
We need to move Out of OOP
Box
Are We Ready to Jump out of OOP Box?
STAGE 1
Understanding Three Basic Concepts
required for Functional Programming.
I Understand that it is difficult to
Jump to an another Paradigm all at
once 
We shall ground our self with the required Concepts,
1. Behavioural Parameterization
2. Lazy Evaluation & Lazy Initialization
3. Lambdas
Behavioural Parameterization
• Context: Usually requirements keeps
changing, it leads to a lot of code changes and
maintenance.
• Behavioural Parameterization is all about
Extracting this “Changing Behaviour” out of
the Context.
• Requirement: Filter green Apples from a
bunch of Apples.
• Change: Add a Support to filter apples by
Weight 
• Change: More Changes 
The Code Bloats 
Do We see a pattern!!!
Question: Based on which
characters the changes happens?
Refinement 1: Creating a Strategy
After Refinement 1, We send a
“Behaviour” as “Parameter”.
This is called “Behavioural
Parameterization”
Refinement 2: Proactive support for
Oranges and More… Generic
Programming with Generics
We have reached our best with Java 7
Next: Lazy Evaluation & Lazy
Initialization.
Next?
Lazy Evaluation
In the above Example, we passed the “behaviour”
not the “value” after executing the behaviour.
Until if condition is reached this behaviour is not
evaluated. This is called “Lazy Evaluation”
Lazy Initialization
“Simple Values” like
colour Blue & Green
enclosed as
“Behaviours”
Lazy Initialization
The Colour Supplier behaviour which carries
the value never got evaluated until it is called
to set the colour for the Wall inside get colour.
Actually the “state” of the Wall Colour was not
initialized despite the wall construction with
“state” until required.
Points to Note
In the case of Apple Filter, The
Behaviour being passed as
parameter carries “expression” of
apple colour check or apple weight
check to be evaluated lazily.
In the case of Wall Class, when you
create Wall, the Behaviour being
passed as parameter carries “value”
to set the state of the object lazily.
We have done with our basics concepts 
Behaviour Passing with Lambdas
In order to pass parameterize behaviours, we might have created “New Classes”
either concrete or anonymous.
In Java 8, we can use Lambdas to pass changing behaviours.
Behaviour Passing with Lambdas
Before Java 8
After Java 8
Lambda Expression
Anonymous
Class instead of
Separate Class
STAGE 2
Basics of Pure Functions.
Mathematical Functions mapping between
Domains.
FUNCTIONS
• Functions are nothing but passable
Behaviours. They are not methods. They may
be “expression” or “value” as said before.
• FP is all about these functions 
• Lambda Expression is Concise form of
Functions.
• A method can act as function when it is an
“expression” or a “value”.
FUNCTIONAL PROGRAMMING
Lambda Expression is a Pure Function
Z= X+Y
F(Z) = 2Z+3Z
After Z expression replacement
F(Z) is not affected
F(X+Y)= 2(X+Y)+3(X+Y)
A SIMPLE Equational Reasoning
FUNCTIONAL PROGRAMMING
FUNCTIONAL PROGRAMMING
FUNCTIONAL PROGRAMMING
FUNCTIONAL PROGRAMMING
STAGE 3
Back to programming.
Once more Concept – “Partial Application”
A SIMPLE CONVERTOR UTILITY
Everything works fine, we
observe across conversion
here the “base” and “factor”
alone need to be changed for
creating different conversion
Behaviours.
We create a Strategy like
before.
Partial Application
Here You can see that
we have “Partially
Applied” Our
Parameters “Base”&
“Factors” in their
respective Strategy
and we have created
a “Behaviour
Parameterization”
Consider, We are
partially passing a part
of the complete
“expression”, and the
rest of the
“expression” is already
applied/present.
Partial Application
Jump 2
Jump 3
This
expression
looks like a
math
expression, a
pure
function!!!
From Simple Utility to Strategy
Jump 1
Points to Note
• We achieved Modularity.
• We applied 2 parameter to create Strategy.
• We have a Problem over here, we have lot of
Anonymous classes or Lambda expression.
STAGE 4
More Programming…
More Abstraction… More Modularity…
Reusing Lambdas
Now Lambda Expression have been reused 
More Helpers
More Helpers like
Apply Factor,
Apply Base
And
Two Weird looking
Methods 
The Weird Looking
Methods are for FP
Function Composition
Parameters Passing
Applying Parameters one by one
Removed unnecessary parameters
LAMBDA EXPRESSION – EXPRESSIONS FOR
ANONYMOUS PURE FUNCTION
Sqsum(x,y) = x * x + y * y; // Pure Function
lambda Expression: (x,y) -> x *x+y*y // Lambda
Expression
Evaluation with (5, 6) will take place by currying & partial
application like
( (x,y) -> x *x+y*y ) (5,6) // with input parameters
((x->(y->x *x+y*y))(5))(6) // Curried or Currying
(y->5*5+y*y)(6) // Partially Applied -> new function
obtained.
5*5+6*6 // complete application of parameters
61
LAMBDA EXPRESSIONS
Why Lambdas & Functional
Programming?
Increasingly dealing with big data (terabytes and up) and wishing to exploit multicore
computers or computing clusters effectively to process data.
And this means using:
parallel processing
FP Makes this Concern to be handled very easily.
big data multicore
cloud
computing
IoT
THE CHANGING COMPUTING BACKGROUND – THE CLIMATE CHANGE
There has been a lot of progress
&
Progress is being allowed to forget things
or leaving it for others concern ;)
THE PROGRESS OF PROGRAMMING
There`s been a lot of progress:
- Assemblers let us forget about opcodes
THE PROGRESS OF PROGRAMMING
There`s been a lot of progress:
- Assemblers let us forget opcodes
- Garbage collections let us forget memory management
#include <stdio.h>
#include <stdlib.h>
int main () {
…
buffer = (char*) malloc (i+1);
…
free (buffer);
…
}
THE PROGRESS OF PROGRAMMING
So what about parallelism?
THE PROGRESS OF PROGRAMMING
Most of parallelism problems are doing bulk operations on collection
and we keep writing code like this:
int sum = 0;
for (int i = 0; i < a.length; i++) {
sum += a[i];
}
It is inherently serial
CURRENT STATE OF PARALLELISM & CONCURRENCY
CURRENT STATE OF PARALLELISM & CONCURRENCY
If the processing of different elements is to proceed in parallel, now it is the responsibility of
the client code
n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … …
sum1 sum2 sum3 sum4
CURRENT STATE OF PARALLELISM & CONCURRENCY
If the processing of different elements is to proceed in parallel, now it is the responsibility of
the client code
n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … …
class Sum implements Callable<Long> {
private final long from;
private final long to;
Sum(long from, long to) {
this.from = from;
this.to = to;
}
public Long call() {
long acc = 0;
for (long i = from; i <= to; i++) {
acc = acc + i;
}
return acc;
}
}
sum1 sum2 sum3 sum4
CURRENT STATE OF PARALLELISM & CONCURRENCY
If the processing of different elements is to proceed in parallel, now it is the responsibility of
the client code
n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … …
sum1 sum2 sum3 sum4
ExecutorService executor = Executors.newFixedThreadPool(2);
List<Future<Long>> results = executor.invokeAll(asList(
new Sum(1, 250),
new Sum(251, 500),
new Sum(551, 750),
new Sum(751, 1000)
));
for (Future<Long> result : results) {
System.out.println(result.get());
}
Partitioning of data from
1-250, 251-500 etc can
also be done with
Java 7 - Fork/Join
Framework (take cares of
Partitioning based on
processor availability
with job stealing
algorithm)
CURRENT STATE OF PARALLELISM & CONCURRENCY
If the processing of different elements is to proceed in
parallel, now it is the responsibility of the client code
Java 8 has a solution for this Problem and it will let us forget Parallel
Processing at required extend .
Driven By the concepts
1. Functional Programming
2. No shared mutable data -> Immutability
3. Behavior Parameterization (Passing code / Anonymous Pure
Functions as parameters).
4. Stream Processing - > Immutable Data Structures - favoring Internal
Iteration over External Iteration.
CURRENT STATE OF PARALLELISM & CONCURRENCY
THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE
Conway’s law
Any organization that designs a system (defined more broadly here
than just information systems) will inevitably produce a design
whose structure is a copy of the organization's communication
structure.
THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE
Onion Architecture
THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE
Pure functions are ideal candidates for reactive modelling because you can freely
distribute them in a parallel setting without any concern for managing mutable shared
state. This is really where functional meets reactive.
Event based programming delineates the “what” from the “how” of your model. And
this is also what functional programming encourages. Events are small messages that
specify what you want to do, and the handler for the event describes the how part. No
wonder functional programming and event driven programming play well together.
With functional design and thinking your model grows organically, and by virtue of
being pure you can treat your model mathematically and reason about it.
Building a DSL or Domain Algebra is easier with FP.
“OOPS bind State & Behaviours, FP Decouples State & Behaviours”
FUNCTIONAL PROGRAMMING
Q & A
Thank You

More Related Content

What's hot

Notes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsNotes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsJay Baxi
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? reactima
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionJeongbae Oh
 
Data weave 2.0 language fundamentals
Data weave 2.0 language fundamentalsData weave 2.0 language fundamentals
Data weave 2.0 language fundamentalsManjuKumara GH
 
Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerIgor Crvenov
 
Functional Programming in Python
Functional Programming in PythonFunctional Programming in Python
Functional Programming in PythonHaim Michael
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Alain Lompo
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India
 
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - Basics
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - BasicsNotes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - Basics
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - BasicsJay Baxi
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101Adam Culp
 
Data weave 2.0 advanced (recursion, pattern matching)
Data weave 2.0   advanced (recursion, pattern matching)Data weave 2.0   advanced (recursion, pattern matching)
Data weave 2.0 advanced (recursion, pattern matching)ManjuKumara GH
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?Ilya Sidorov
 
Notes: Verilog Part 4- Behavioural Modelling
Notes: Verilog Part 4- Behavioural ModellingNotes: Verilog Part 4- Behavioural Modelling
Notes: Verilog Part 4- Behavioural ModellingJay Baxi
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Harmeet Singh(Taara)
 
Generics On The JVM (What you don't know will hurt you)
Generics On The JVM (What you don't know will hurt you)Generics On The JVM (What you don't know will hurt you)
Generics On The JVM (What you don't know will hurt you)Garth Gilmour
 

What's hot (20)

Notes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and FunctionsNotes: Verilog Part 5 - Tasks and Functions
Notes: Verilog Part 5 - Tasks and Functions
 
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD? WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
 
Intro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: FunctionIntro to JavaScript - Week 2: Function
Intro to JavaScript - Week 2: Function
 
Insight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FPInsight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FP
 
Books
BooksBooks
Books
 
Data weave 2.0 language fundamentals
Data weave 2.0 language fundamentalsData weave 2.0 language fundamentals
Data weave 2.0 language fundamentals
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Refactoring Tips by Martin Fowler
Refactoring Tips by Martin FowlerRefactoring Tips by Martin Fowler
Refactoring Tips by Martin Fowler
 
Functional Programming in Python
Functional Programming in PythonFunctional Programming in Python
Functional Programming in Python
 
Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...Designing function families and bundles with java's behaviors parameterisatio...
Designing function families and bundles with java's behaviors parameterisatio...
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
 
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - Basics
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - BasicsNotes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - Basics
Notes: Verilog Part 1 - Overview - Hierarchical Modeling Concepts - Basics
 
Refactoring 101
Refactoring 101Refactoring 101
Refactoring 101
 
Data weave 2.0 advanced (recursion, pattern matching)
Data weave 2.0   advanced (recursion, pattern matching)Data weave 2.0   advanced (recursion, pattern matching)
Data weave 2.0 advanced (recursion, pattern matching)
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?
 
Notes: Verilog Part 4- Behavioural Modelling
Notes: Verilog Part 4- Behavioural ModellingNotes: Verilog Part 4- Behavioural Modelling
Notes: Verilog Part 4- Behavioural Modelling
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
 
Generics On The JVM (What you don't know will hurt you)
Generics On The JVM (What you don't know will hurt you)Generics On The JVM (What you don't know will hurt you)
Generics On The JVM (What you don't know will hurt you)
 
Create and analyse programs
Create and analyse programsCreate and analyse programs
Create and analyse programs
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 

Viewers also liked

java script functions, classes
java script functions, classesjava script functions, classes
java script functions, classesVijay Kalyan
 
Functional Programming in Java 8 - Exploiting Lambdas
Functional Programming in Java 8 - Exploiting LambdasFunctional Programming in Java 8 - Exploiting Lambdas
Functional Programming in Java 8 - Exploiting LambdasGanesh Samarthyam
 
2ndQuarter2ndMeeting(formatting number)
2ndQuarter2ndMeeting(formatting number)2ndQuarter2ndMeeting(formatting number)
2ndQuarter2ndMeeting(formatting number)Esmeraldo Jr Guimbarda
 
TM 2nd qtr-3ndmeeting(java script-functions)
TM 2nd qtr-3ndmeeting(java script-functions)TM 2nd qtr-3ndmeeting(java script-functions)
TM 2nd qtr-3ndmeeting(java script-functions)Esmeraldo Jr Guimbarda
 
Lambda functions in java 8
Lambda functions in java 8Lambda functions in java 8
Lambda functions in java 8James Brown
 
Week 5 java script functions
Week 5  java script functionsWeek 5  java script functions
Week 5 java script functionsbrianjihoonlee
 
ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingIstanbul Tech Talks
 
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programmingintive
 
02 java programming basic
02  java programming basic02  java programming basic
02 java programming basicZeeshan-Shaikh
 
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...Philip Schwarz
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions Reem Alattas
 
Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascriptguest4d57e6
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsColin DeCarlo
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In JavaAndrei Solntsev
 

Viewers also liked (20)

java script functions, classes
java script functions, classesjava script functions, classes
java script functions, classes
 
Functional Programming in Java 8 - Exploiting Lambdas
Functional Programming in Java 8 - Exploiting LambdasFunctional Programming in Java 8 - Exploiting Lambdas
Functional Programming in Java 8 - Exploiting Lambdas
 
2ndQuarter2ndMeeting(formatting number)
2ndQuarter2ndMeeting(formatting number)2ndQuarter2ndMeeting(formatting number)
2ndQuarter2ndMeeting(formatting number)
 
2java Oop
2java Oop2java Oop
2java Oop
 
TM 2nd qtr-3ndmeeting(java script-functions)
TM 2nd qtr-3ndmeeting(java script-functions)TM 2nd qtr-3ndmeeting(java script-functions)
TM 2nd qtr-3ndmeeting(java script-functions)
 
Lambda functions in java 8
Lambda functions in java 8Lambda functions in java 8
Lambda functions in java 8
 
Week 5 java script functions
Week 5  java script functionsWeek 5  java script functions
Week 5 java script functions
 
ITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function ProgrammingITT 2015 - Saul Mora - Object Oriented Function Programming
ITT 2015 - Saul Mora - Object Oriented Function Programming
 
Java Script - Object-Oriented Programming
Java Script - Object-Oriented ProgrammingJava Script - Object-Oriented Programming
Java Script - Object-Oriented Programming
 
02 java programming basic
02  java programming basic02  java programming basic
02 java programming basic
 
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...
Understanding Java 8 Lambdas and Streams - Part 1 - Lambda Calculus, Lambda...
 
Fp java8
Fp java8Fp java8
Fp java8
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
JavaScript Functions
JavaScript Functions JavaScript Functions
JavaScript Functions
 
Functional Javascript
Functional JavascriptFunctional Javascript
Functional Javascript
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Functional programming in java
Functional programming in javaFunctional programming in java
Functional programming in java
 
Programming
ProgrammingProgramming
Programming
 
Basic java for Android Developer
Basic java for Android DeveloperBasic java for Android Developer
Basic java for Android Developer
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 

Similar to Functional Programming in Java

Functional Paradigm.pptx
Functional Paradigm.pptxFunctional Paradigm.pptx
Functional Paradigm.pptxFurretMaster
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programmingsamthemonad
 
Functional Programming In Jdk8
Functional Programming In Jdk8 Functional Programming In Jdk8
Functional Programming In Jdk8 Bansilal Haudakari
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1SURBHI SAROHA
 
Javascripts hidden treasures BY - https://geekyants.com/
Javascripts hidden treasures            BY  -  https://geekyants.com/Javascripts hidden treasures            BY  -  https://geekyants.com/
Javascripts hidden treasures BY - https://geekyants.com/Geekyants
 
JAVA(module1).pptx
JAVA(module1).pptxJAVA(module1).pptx
JAVA(module1).pptxSRKCREATIONS
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
How To Use IO Monads in Scala?
 How To Use IO Monads in Scala? How To Use IO Monads in Scala?
How To Use IO Monads in Scala?Knoldus Inc.
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave ImplicitMartin Odersky
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8icarter09
 
Functional Swift
Functional SwiftFunctional Swift
Functional SwiftGeison Goes
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptxStefan Oprea
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhHarmeet Singh(Taara)
 
Knowledge of Javascript
Knowledge of JavascriptKnowledge of Javascript
Knowledge of JavascriptSamuel Abraham
 
Learn To Code: Introduction to java
Learn To Code: Introduction to javaLearn To Code: Introduction to java
Learn To Code: Introduction to javaSadhanaParameswaran
 

Similar to Functional Programming in Java (20)

What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
 
Functional Paradigm.pptx
Functional Paradigm.pptxFunctional Paradigm.pptx
Functional Paradigm.pptx
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
Functional Programming In Jdk8
Functional Programming In Jdk8 Functional Programming In Jdk8
Functional Programming In Jdk8
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1
 
Javascripts hidden treasures BY - https://geekyants.com/
Javascripts hidden treasures            BY  -  https://geekyants.com/Javascripts hidden treasures            BY  -  https://geekyants.com/
Javascripts hidden treasures BY - https://geekyants.com/
 
Introduction to Functional programming
Introduction to Functional programmingIntroduction to Functional programming
Introduction to Functional programming
 
JAVA(module1).pptx
JAVA(module1).pptxJAVA(module1).pptx
JAVA(module1).pptx
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
How To Use IO Monads in Scala?
 How To Use IO Monads in Scala? How To Use IO Monads in Scala?
How To Use IO Monads in Scala?
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
What To Leave Implicit
What To Leave ImplicitWhat To Leave Implicit
What To Leave Implicit
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
 
Javascript
JavascriptJavascript
Javascript
 
Functional Swift
Functional SwiftFunctional Swift
Functional Swift
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
 
Java 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENTJava 3 rd sem. 2012 aug.ASSIGNMENT
Java 3 rd sem. 2012 aug.ASSIGNMENT
 
Knowledge of Javascript
Knowledge of JavascriptKnowledge of Javascript
Knowledge of Javascript
 
Learn To Code: Introduction to java
Learn To Code: Introduction to javaLearn To Code: Introduction to java
Learn To Code: Introduction to java
 

More from Narendran Solai Sridharan (9)

Java module configuration
Java module configurationJava module configuration
Java module configuration
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Thinking tools for value innovation
Thinking tools for value innovationThinking tools for value innovation
Thinking tools for value innovation
 
Domain driven design - Part I
Domain driven design - Part IDomain driven design - Part I
Domain driven design - Part I
 
Raspberry pi and pi4j
Raspberry pi and pi4jRaspberry pi and pi4j
Raspberry pi and pi4j
 
Http 2
Http 2Http 2
Http 2
 
Introduction to value types
Introduction to value typesIntroduction to value types
Introduction to value types
 
Upfront adoption & migration of applications to latest jdk
Upfront adoption & migration of applications to latest jdkUpfront adoption & migration of applications to latest jdk
Upfront adoption & migration of applications to latest jdk
 

Recently uploaded

How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 

Recently uploaded (20)

How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 

Functional Programming in Java

  • 1. Functional Programming in Java Narendran, S S
  • 2. THERE IS A CHANGE IN “THE CLIMATE” TO CHANGE OUR WAYS “LAMBDAS IN JAVA 8 IS NOT FOR WHAT THEY CAN DO, IT IS ABOUT HOW WE WRITE PROGRAM” IT ENABLES FUNCTIONAL PROGRAMMING, IT ADDS A NEW NUCLEOTIDES IN THE DNA OF JAVA. Structural Reflective Object Oriented Functional & Declarative Imperative Concurrent Generic
  • 3. My FP Inspirations!!! Douglas Crockford Mario Fusco Brian Goetz Venkat Subramaniam “JavaScript: The Good Parts” Book Author “Java 8 in Action” Book Author Java Specification Lead “Java Lambdas is one of the specificaiton” “Functional Programming in Java” Book Author
  • 4. We need to move Out of OOP Box Are We Ready to Jump out of OOP Box?
  • 5. STAGE 1 Understanding Three Basic Concepts required for Functional Programming.
  • 6. I Understand that it is difficult to Jump to an another Paradigm all at once  We shall ground our self with the required Concepts, 1. Behavioural Parameterization 2. Lazy Evaluation & Lazy Initialization 3. Lambdas
  • 7. Behavioural Parameterization • Context: Usually requirements keeps changing, it leads to a lot of code changes and maintenance. • Behavioural Parameterization is all about Extracting this “Changing Behaviour” out of the Context.
  • 8. • Requirement: Filter green Apples from a bunch of Apples.
  • 9. • Change: Add a Support to filter apples by Weight 
  • 10. • Change: More Changes  The Code Bloats 
  • 11. Do We see a pattern!!! Question: Based on which characters the changes happens?
  • 13. After Refinement 1, We send a “Behaviour” as “Parameter”. This is called “Behavioural Parameterization”
  • 14. Refinement 2: Proactive support for Oranges and More… Generic Programming with Generics We have reached our best with Java 7
  • 15. Next: Lazy Evaluation & Lazy Initialization. Next?
  • 16. Lazy Evaluation In the above Example, we passed the “behaviour” not the “value” after executing the behaviour. Until if condition is reached this behaviour is not evaluated. This is called “Lazy Evaluation”
  • 17. Lazy Initialization “Simple Values” like colour Blue & Green enclosed as “Behaviours”
  • 18. Lazy Initialization The Colour Supplier behaviour which carries the value never got evaluated until it is called to set the colour for the Wall inside get colour. Actually the “state” of the Wall Colour was not initialized despite the wall construction with “state” until required.
  • 19. Points to Note In the case of Apple Filter, The Behaviour being passed as parameter carries “expression” of apple colour check or apple weight check to be evaluated lazily. In the case of Wall Class, when you create Wall, the Behaviour being passed as parameter carries “value” to set the state of the object lazily. We have done with our basics concepts 
  • 20. Behaviour Passing with Lambdas In order to pass parameterize behaviours, we might have created “New Classes” either concrete or anonymous. In Java 8, we can use Lambdas to pass changing behaviours.
  • 21. Behaviour Passing with Lambdas Before Java 8 After Java 8 Lambda Expression Anonymous Class instead of Separate Class
  • 22. STAGE 2 Basics of Pure Functions. Mathematical Functions mapping between Domains.
  • 23. FUNCTIONS • Functions are nothing but passable Behaviours. They are not methods. They may be “expression” or “value” as said before. • FP is all about these functions  • Lambda Expression is Concise form of Functions. • A method can act as function when it is an “expression” or a “value”.
  • 25. Z= X+Y F(Z) = 2Z+3Z After Z expression replacement F(Z) is not affected F(X+Y)= 2(X+Y)+3(X+Y) A SIMPLE Equational Reasoning FUNCTIONAL PROGRAMMING
  • 29. STAGE 3 Back to programming. Once more Concept – “Partial Application”
  • 30. A SIMPLE CONVERTOR UTILITY Everything works fine, we observe across conversion here the “base” and “factor” alone need to be changed for creating different conversion Behaviours. We create a Strategy like before.
  • 31. Partial Application Here You can see that we have “Partially Applied” Our Parameters “Base”& “Factors” in their respective Strategy and we have created a “Behaviour Parameterization” Consider, We are partially passing a part of the complete “expression”, and the rest of the “expression” is already applied/present.
  • 32. Partial Application Jump 2 Jump 3 This expression looks like a math expression, a pure function!!! From Simple Utility to Strategy Jump 1
  • 33. Points to Note • We achieved Modularity. • We applied 2 parameter to create Strategy. • We have a Problem over here, we have lot of Anonymous classes or Lambda expression.
  • 34. STAGE 4 More Programming… More Abstraction… More Modularity…
  • 35. Reusing Lambdas Now Lambda Expression have been reused 
  • 36. More Helpers More Helpers like Apply Factor, Apply Base And Two Weird looking Methods  The Weird Looking Methods are for FP Function Composition
  • 37. Parameters Passing Applying Parameters one by one Removed unnecessary parameters
  • 38. LAMBDA EXPRESSION – EXPRESSIONS FOR ANONYMOUS PURE FUNCTION Sqsum(x,y) = x * x + y * y; // Pure Function lambda Expression: (x,y) -> x *x+y*y // Lambda Expression Evaluation with (5, 6) will take place by currying & partial application like ( (x,y) -> x *x+y*y ) (5,6) // with input parameters ((x->(y->x *x+y*y))(5))(6) // Curried or Currying (y->5*5+y*y)(6) // Partially Applied -> new function obtained. 5*5+6*6 // complete application of parameters 61 LAMBDA EXPRESSIONS
  • 39. Why Lambdas & Functional Programming?
  • 40. Increasingly dealing with big data (terabytes and up) and wishing to exploit multicore computers or computing clusters effectively to process data. And this means using: parallel processing FP Makes this Concern to be handled very easily. big data multicore cloud computing IoT THE CHANGING COMPUTING BACKGROUND – THE CLIMATE CHANGE
  • 41. There has been a lot of progress & Progress is being allowed to forget things or leaving it for others concern ;) THE PROGRESS OF PROGRAMMING
  • 42. There`s been a lot of progress: - Assemblers let us forget about opcodes THE PROGRESS OF PROGRAMMING
  • 43. There`s been a lot of progress: - Assemblers let us forget opcodes - Garbage collections let us forget memory management #include <stdio.h> #include <stdlib.h> int main () { … buffer = (char*) malloc (i+1); … free (buffer); … } THE PROGRESS OF PROGRAMMING
  • 44. So what about parallelism? THE PROGRESS OF PROGRAMMING
  • 45. Most of parallelism problems are doing bulk operations on collection and we keep writing code like this: int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i]; } It is inherently serial CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 46. CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 47. If the processing of different elements is to proceed in parallel, now it is the responsibility of the client code n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … … sum1 sum2 sum3 sum4 CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 48. If the processing of different elements is to proceed in parallel, now it is the responsibility of the client code n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … … class Sum implements Callable<Long> { private final long from; private final long to; Sum(long from, long to) { this.from = from; this.to = to; } public Long call() { long acc = 0; for (long i = from; i <= to; i++) { acc = acc + i; } return acc; } } sum1 sum2 sum3 sum4 CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 49. If the processing of different elements is to proceed in parallel, now it is the responsibility of the client code n1 n2 n3 n4 n5 n6 n7 n8 n9 … … … … sum1 sum2 sum3 sum4 ExecutorService executor = Executors.newFixedThreadPool(2); List<Future<Long>> results = executor.invokeAll(asList( new Sum(1, 250), new Sum(251, 500), new Sum(551, 750), new Sum(751, 1000) )); for (Future<Long> result : results) { System.out.println(result.get()); } Partitioning of data from 1-250, 251-500 etc can also be done with Java 7 - Fork/Join Framework (take cares of Partitioning based on processor availability with job stealing algorithm) CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 50. If the processing of different elements is to proceed in parallel, now it is the responsibility of the client code Java 8 has a solution for this Problem and it will let us forget Parallel Processing at required extend . Driven By the concepts 1. Functional Programming 2. No shared mutable data -> Immutability 3. Behavior Parameterization (Passing code / Anonymous Pure Functions as parameters). 4. Stream Processing - > Immutable Data Structures - favoring Internal Iteration over External Iteration. CURRENT STATE OF PARALLELISM & CONCURRENCY
  • 51. THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE Conway’s law Any organization that designs a system (defined more broadly here than just information systems) will inevitably produce a design whose structure is a copy of the organization's communication structure.
  • 52. THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE Onion Architecture
  • 53. THE CHANGING DEVELOPMENT BACKGROUND IS THE CLIMATE CHANGE Pure functions are ideal candidates for reactive modelling because you can freely distribute them in a parallel setting without any concern for managing mutable shared state. This is really where functional meets reactive. Event based programming delineates the “what” from the “how” of your model. And this is also what functional programming encourages. Events are small messages that specify what you want to do, and the handler for the event describes the how part. No wonder functional programming and event driven programming play well together. With functional design and thinking your model grows organically, and by virtue of being pure you can treat your model mathematically and reason about it. Building a DSL or Domain Algebra is easier with FP.
  • 54. “OOPS bind State & Behaviours, FP Decouples State & Behaviours” FUNCTIONAL PROGRAMMING
  • 55. Q & A