SlideShare a Scribd company logo
Oh-Oh to Functional 
Introduction to Functional Thinking 
naresh@agilefaqs.com 
@nashjain 
http://nareshjain.com
Agenda 
Object-Oriented Design Principles (SOLID, DRY) 
Functional Concepts 
Single Abstract Method (SAM) 
Pure Functions 
Immutability 
High-Order Functions 
Lambda Expressions 
Lazy evaluation 
Functional Composition 
Declarative vs. Imperative programming style 
Quick Demo - Java 8 Functional Features
Commercial Break!
http://agilefaqs.com | Copyright © 2014, AgileFAQs. All Rights Reserved.
Mumbai
Tech Talks!
MathWorks Game 
Courtesy 
dhaval@agilefaqs.com 
@softwareartisan
2 
4 
5 
1 
2 
6 
4 
Σ 
xⁿ 
5 
7 
11
Story #1 
As a Kid learning arithmetics, 
I want to identify even numbers 
So that I can grow my understanding of 
odd and even numbers.
Acceptance Criteria 
#1 
Given numbers 1, 2, 3, 4, 5 and 6 
When using the Odd filter and emptying contents of the 
source bucket to target bucket 
Then target bucket should contain 2, 4 and 6. 
#2 
Given numbers -2 and 3 
When using the odd filter and emptying contents of the 
source bucket to target bucket 
Then target bucket should contain -2.
1 
6 
2 
4 
5 
3 
7 
Σ 
xⁿ 
9
Story #2 
As a Kid learning arithmetics, 
I want to identify prime numbers 
So that I can differentiate between 
composite and prime numbers.
Acceptance Criteria 
#1 
Given numbers 2, 4, 6, 7, 9 and 11 
When using Prime filter and emptying contents of the 
source bucket to target bucket 
Then target bucket should contain 2, 7 and 11. 
#2 
Given numbers -1, -2, 3, and 4 
When using Prime filter and emptying contents of the 
source bucket to target bucket 
Then target bucket should contain 3.
1 
11 
2 
4 
5 
-3 
4 
Σ 
xⁿ 
9 
7
Story #3 
As a Kid learning arithmetics, 
I want to identify odd primes 
So that I can understand numbers that 
are odd and primes at the same time.
Acceptance Criteria 
Given numbers 2, 4, 5, 6 and 7 
When using the Odd and prime filters 
and emptying contents of the source 
bucket to target bucket 
Then target bucket should contain 5 
and 7.
2 
4 
5 
1 
2 
6 
4 
Σ 
xⁿ 
5 
7 
11
Story #4 
As a Kid learning arithmetics, 
I want to identify numbers within a 
range 
So that I can grow my understanding 
of ranges.
Acceptance Criteria 
Given there are numbers 5, 7, 10 and 15 
When using the range between 5..10 
and emptying contents of the source 
bucket to target bucket 
Then target bucket should contain 5, 7 
and 10.
2 
4 
5 
3 
8 
1 
7 
Σ 
xⁿ 
9
Story #5 
As a Kid learning arithmetics, 
I want to sum all the numbers that are 
in the bucket. 
So that I can learn addition.
Acceptance Criteria 
Given numbers 5, 7, 10 and 5 
When using the aggregator and 
emptying contents of the source bucket 
to target bucket 
Then target bucket should contain 27.
2 
4 
5 
1 
2 
6 
4 
Σ 
xⁿ 
12 
11 
Σ
Story #6 
As a Kid learning arithmetics, 
I want to multiply all numbers in a 
bucket. 
So that I can grow my understanding 
of numbers.
Acceptance Criteria 
Given numbers 2, 4 and 6 
When using the multiplier and 
emptying contents of the source bucket 
to target bucket 
Then target bucket should contain 48.
2 
4 
5 
1 
2 
6 
4 
Σ 
xⁿ 
48 
11 
*
Story #7 
As a Kid learning arithmetics, 
I want to sum all odd primes within a 
range. 
So that I can grow my understanding 
of numbers.
Acceptance Criteria 
Given numbers 1, 2, 5, 7, 8, 10 and 15 
When using the range 2..10 and 
emptying contents of the source bucket 
to target bucket 
Then target bucket should contain 12.
2 
4 
5 
1 
2 
6 
4 
Σ 
xⁿ 
5 
7 
11 
Σ 
12
Functional Features in 
Java 8 
Quick Demo
Thank You 
Questions? 
naresh@agilefaqs.com 
@nashjain

More Related Content

Similar to Oh Oh To Functional (11)

NCTM 2015 Filling Knowledge Gaps with Critical Singapore Math® Approach (Gr. ...
NCTM 2015 Filling Knowledge Gaps with Critical Singapore Math® Approach (Gr. ...NCTM 2015 Filling Knowledge Gaps with Critical Singapore Math® Approach (Gr. ...
NCTM 2015 Filling Knowledge Gaps with Critical Singapore Math® Approach (Gr. ...
 
Division.pptx
Division.pptxDivision.pptx
Division.pptx
 
Presentation 5 quantity magnitude and numeration january 2
Presentation 5 quantity   magnitude and numeration january 2Presentation 5 quantity   magnitude and numeration january 2
Presentation 5 quantity magnitude and numeration january 2
 
Math Gr4 Ch5
Math Gr4 Ch5Math Gr4 Ch5
Math Gr4 Ch5
 
1. guía de trabajo autónomo 8vo 2021
1. guía de trabajo autónomo 8vo  20211. guía de trabajo autónomo 8vo  2021
1. guía de trabajo autónomo 8vo 2021
 
Fridge magnets
Fridge magnetsFridge magnets
Fridge magnets
 
RANCANGAN PENGAJARAN TAHUNAN-Mathematics-Year-1-DLP-2021.docx
RANCANGAN PENGAJARAN TAHUNAN-Mathematics-Year-1-DLP-2021.docxRANCANGAN PENGAJARAN TAHUNAN-Mathematics-Year-1-DLP-2021.docx
RANCANGAN PENGAJARAN TAHUNAN-Mathematics-Year-1-DLP-2021.docx
 
Math Gr4 Ch7
Math Gr4 Ch7Math Gr4 Ch7
Math Gr4 Ch7
 
1. python for data science
1. python for data science1. python for data science
1. python for data science
 
New Teacher Institute 2013
New Teacher Institute 2013New Teacher Institute 2013
New Teacher Institute 2013
 
Harry's Shop Finances Main Activity
Harry's Shop Finances Main ActivityHarry's Shop Finances Main Activity
Harry's Shop Finances Main Activity
 

More from Naresh Jain

Organizational Resilience
Organizational ResilienceOrganizational Resilience
Organizational Resilience
Naresh Jain
 
Improving the Quality of Incoming Code
Improving the Quality of Incoming CodeImproving the Quality of Incoming Code
Improving the Quality of Incoming Code
Naresh Jain
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
Naresh Jain
 

More from Naresh Jain (20)

Problem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary DesignProblem Solving Techniques For Evolutionary Design
Problem Solving Techniques For Evolutionary Design
 
Agile India 2019 Conference Welcome Note
Agile India 2019 Conference Welcome NoteAgile India 2019 Conference Welcome Note
Agile India 2019 Conference Welcome Note
 
Organizational Resilience
Organizational ResilienceOrganizational Resilience
Organizational Resilience
 
Improving the Quality of Incoming Code
Improving the Quality of Incoming CodeImproving the Quality of Incoming Code
Improving the Quality of Incoming Code
 
Agile India 2018 Conference Summary
Agile India 2018 Conference SummaryAgile India 2018 Conference Summary
Agile India 2018 Conference Summary
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Agile India 2018 Conference
Agile India 2018 ConferenceAgile India 2018 Conference
Agile India 2018 Conference
 
Pilgrim's Progress to the Promised Land by Robert Virding
Pilgrim's Progress to the Promised Land by Robert VirdingPilgrim's Progress to the Promised Land by Robert Virding
Pilgrim's Progress to the Promised Land by Robert Virding
 
Concurrent languages are Functional by Francesco Cesarini
Concurrent languages are Functional by Francesco CesariniConcurrent languages are Functional by Francesco Cesarini
Concurrent languages are Functional by Francesco Cesarini
 
Erlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco CesariniErlang from behing the trenches by Francesco Cesarini
Erlang from behing the trenches by Francesco Cesarini
 
Anatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur DatarAnatomy of an eCommerce Search Engine by Mayur Datar
Anatomy of an eCommerce Search Engine by Mayur Datar
 
Setting up Continuous Delivery Culture for a Large Scale Mobile App
Setting up Continuous Delivery Culture for a Large Scale Mobile AppSetting up Continuous Delivery Culture for a Large Scale Mobile App
Setting up Continuous Delivery Culture for a Large Scale Mobile App
 
Towards FutureOps: Stable, Repeatable environments from Dev to Prod
Towards FutureOps: Stable, Repeatable environments from Dev to ProdTowards FutureOps: Stable, Repeatable environments from Dev to Prod
Towards FutureOps: Stable, Repeatable environments from Dev to Prod
 
Value Driven Development by Dave Thomas
Value Driven Development by Dave Thomas Value Driven Development by Dave Thomas
Value Driven Development by Dave Thomas
 
No Silver Bullets in Functional Programming by Brian McKenna
No Silver Bullets in Functional Programming by Brian McKennaNo Silver Bullets in Functional Programming by Brian McKenna
No Silver Bullets in Functional Programming by Brian McKenna
 
Functional Programming Conference 2016
Functional Programming Conference 2016Functional Programming Conference 2016
Functional Programming Conference 2016
 
Agile India 2017 Conference
Agile India 2017 ConferenceAgile India 2017 Conference
Agile India 2017 Conference
 
The Eclipse Way
The Eclipse WayThe Eclipse Way
The Eclipse Way
 
Unleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDTUnleashing the Power of Automated Refactoring with JDT
Unleashing the Power of Automated Refactoring with JDT
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Recently uploaded (20)

10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 

Oh Oh To Functional

  • 1. Oh-Oh to Functional Introduction to Functional Thinking naresh@agilefaqs.com @nashjain http://nareshjain.com
  • 2. Agenda Object-Oriented Design Principles (SOLID, DRY) Functional Concepts Single Abstract Method (SAM) Pure Functions Immutability High-Order Functions Lambda Expressions Lazy evaluation Functional Composition Declarative vs. Imperative programming style Quick Demo - Java 8 Functional Features
  • 4. http://agilefaqs.com | Copyright © 2014, AgileFAQs. All Rights Reserved.
  • 6.
  • 7.
  • 8.
  • 10.
  • 11. MathWorks Game Courtesy dhaval@agilefaqs.com @softwareartisan
  • 12. 2 4 5 1 2 6 4 Σ xⁿ 5 7 11
  • 13. Story #1 As a Kid learning arithmetics, I want to identify even numbers So that I can grow my understanding of odd and even numbers.
  • 14. Acceptance Criteria #1 Given numbers 1, 2, 3, 4, 5 and 6 When using the Odd filter and emptying contents of the source bucket to target bucket Then target bucket should contain 2, 4 and 6. #2 Given numbers -2 and 3 When using the odd filter and emptying contents of the source bucket to target bucket Then target bucket should contain -2.
  • 15. 1 6 2 4 5 3 7 Σ xⁿ 9
  • 16. Story #2 As a Kid learning arithmetics, I want to identify prime numbers So that I can differentiate between composite and prime numbers.
  • 17. Acceptance Criteria #1 Given numbers 2, 4, 6, 7, 9 and 11 When using Prime filter and emptying contents of the source bucket to target bucket Then target bucket should contain 2, 7 and 11. #2 Given numbers -1, -2, 3, and 4 When using Prime filter and emptying contents of the source bucket to target bucket Then target bucket should contain 3.
  • 18. 1 11 2 4 5 -3 4 Σ xⁿ 9 7
  • 19. Story #3 As a Kid learning arithmetics, I want to identify odd primes So that I can understand numbers that are odd and primes at the same time.
  • 20. Acceptance Criteria Given numbers 2, 4, 5, 6 and 7 When using the Odd and prime filters and emptying contents of the source bucket to target bucket Then target bucket should contain 5 and 7.
  • 21. 2 4 5 1 2 6 4 Σ xⁿ 5 7 11
  • 22. Story #4 As a Kid learning arithmetics, I want to identify numbers within a range So that I can grow my understanding of ranges.
  • 23. Acceptance Criteria Given there are numbers 5, 7, 10 and 15 When using the range between 5..10 and emptying contents of the source bucket to target bucket Then target bucket should contain 5, 7 and 10.
  • 24. 2 4 5 3 8 1 7 Σ xⁿ 9
  • 25. Story #5 As a Kid learning arithmetics, I want to sum all the numbers that are in the bucket. So that I can learn addition.
  • 26. Acceptance Criteria Given numbers 5, 7, 10 and 5 When using the aggregator and emptying contents of the source bucket to target bucket Then target bucket should contain 27.
  • 27. 2 4 5 1 2 6 4 Σ xⁿ 12 11 Σ
  • 28. Story #6 As a Kid learning arithmetics, I want to multiply all numbers in a bucket. So that I can grow my understanding of numbers.
  • 29. Acceptance Criteria Given numbers 2, 4 and 6 When using the multiplier and emptying contents of the source bucket to target bucket Then target bucket should contain 48.
  • 30. 2 4 5 1 2 6 4 Σ xⁿ 48 11 *
  • 31. Story #7 As a Kid learning arithmetics, I want to sum all odd primes within a range. So that I can grow my understanding of numbers.
  • 32. Acceptance Criteria Given numbers 1, 2, 5, 7, 8, 10 and 15 When using the range 2..10 and emptying contents of the source bucket to target bucket Then target bucket should contain 12.
  • 33. 2 4 5 1 2 6 4 Σ xⁿ 5 7 11 Σ 12
  • 34. Functional Features in Java 8 Quick Demo
  • 35. Thank You Questions? naresh@agilefaqs.com @nashjain