SlideShare uma empresa Scribd logo
1 de 33
KPI driven JAVA(functional) development
Gradual journey from imperative to functional development in JAVA
Anirban Bhattacharjee – Architect @ Walmart Labs
About my
functional
exposure
Writing java for
living … since
JDK 4 (mostly
OO way in the
last decade)
Came across
clojure/scala
around
2010…and used
in production
Learning and
using F# since
last year
@work
Occasional
tinkering with
OCaml and
Haskell
Problem Statement
• We have tons of code written in JAVA
• Where will I find developer?
• One company one tech stack…
• Performance, Monitoring, Support?
• Interop, library support.
CAN I STILL WRITE FUNCTIONAL CODE, IMPROVE KPI, MAKE MY LEADERSHIP HAPPY
Today’s JAVA
OOO -> FP
Functional programming is mainstream
since JDK 8 (GA – 2014)
We could use the power of FP ever since
then
Powerful Lambdas/Streams
Collection Enhancements
Function, Supplier, Consumer
Growing eco-system
• Many promising and production ready libraries
• Clean APIs
• Reduction of verbosity, testable and concise code
• Great dev tools
• Rapid learning from other functional programming languages
KPI improvements (target areas)
using FP in java
SONAR
DEVELOPER
PRODUCTIVITY
Time to market
GC, PERF
IMPROVEMENT
Journey to FP
• Birds eye view of functional java
• Additional powerful frameworks
 vavr
 functional java
 streamex
 Atlassian fugue
 misc…
Functional Java : Stream basics
Loop
List<String> countries = new
ArrayList<>();
for (String s : allCountries) {
if (s.startsWith(“I")) {
countries.add(s);
}
}
Stream
List<String> countries
= allCountries.stream()
.filter(a -> a.startsWith(“I"))
.collect(toList())
Functional Java : Stream illustrated
Origin EndOp 1 Op 2 Op n
Data Pipeline Start Data Pipeline End
Intermediate
Operations
Functional Java : Map, reduce, collect
List<String> list = Stream.of("India", "Iceland",“Peru“,"Italy")
.filter(s -> s.startsWith("I"))
.map(String::toUpperCase)
.sorted()
.collect(toList())
India Iceland ItalyPeru
India Iceland Italy
INDIA ICELAND ITALY
ICELAND INDIA ITALY
ICELAND INDIA ITALY
1
2
3
4
5
1
2
3
4
5
Intermediate Operation : Filter
Ind It UKJP
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK")
.filter(s -> s.startsWith("I"));
1
2
Functional Java : Intermediate Operation
Ind It UKJP
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK")
.limit(3);
1
2
JP
Functional Java : Intermediate Operation
Ind It UKJP
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK", "UK")
.distinct();
1
2
JP
UK
UK
Functional Java : Intermediate Operation
Ind It UKUS
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", “US", "UK")
.sorted();
1
2
UK US
Functional Java : Intermediate Operation
Ind It UKUS
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", “US", "UK")
.sorted(Comparator.comparing(String::length));
1
2
UK US
Functional Java : Terminal Operation
Ind It UKJP
Ind
It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK")
.forEach(System.out.println());
1
2
JP
UK
Functional Java : Downstream Collectors
Ind It UKJP
Ind It
1
2
Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK”, "UK” )
.collect(Collectors.toSet());
1
2
JP UK
UK
Functional Java : Custom Downstream collector
return Collector.of(
() -> new ArrayList<T>(), // supplier
(a, e) -> { a.add(e); }, // accumulator
(a, b) -> { a.addAll(b); return a; }, // combiner
a -> { // finisher
a.sort(comp);
DA da = downstream.supplier().get();
for (T e : a)
downstream.accumulator().accept(da, e);
return downstream.finisher().apply(da);
});
Stream<Locale> locales =
Stream.of(Locale.getAvailableLocales());
var result = locales.collect(
groupingBy(Locale::getCountry,
mapping(Locale::getDisplayName,
sorting(String::compareTo,
joining(",")))));
Functional Java : Collection enhancemetns
map.forEach((k, v) -> System.out.println(k + v));for (Map.Entry<String,String> entry : map.entrySet())
System.out.println(entry.getKey() + entry.getValue());
for (Map.Entry<String,String> entry : map.entrySet())
entry.setValue(entry.getValue().toLowerCase());
map.replaceAll((k, v) -> v.toLowerCase());
map.computeIfAbsent(str, x -> HashsSet::new).add(i);Set<Integer> set = multimap.get(str);
if (set == null) {
set = new HashSet<>();
multimap.put(str, set);
}
set.add(i);
Functional Java : More Collection Examples
Contents
Functional Java : Consumer, Supplier, Functions
Contents
Functional Java : Byte Code
• Is Functional java only syntactic sugar?
• Byte code improvements
• Example of Byte code of BEFORE and AFTER
Functional Java : Byte Code
• Is Functional java only syntactic sugar?
• Byte code improvements
• Example of Byte code
Vavr
Vavr : basics
• New functional data-structures (persistent) with superior
performance
• Pure Functions, monads, superior exception management
• Less verbosity
• Great Functional semantics
Vavr : Examples
• LIST, TREE, SET and the cool APIs
•
Vavr : Examples
• CHECKED FUNCTION, CONSUMER, PREDICATE
•
Vavr : Examples
• CHECKED FUNCTION, CONSUMER, PREDICATE
•
Other frameworks: Streamex, Fugue etc..
• CHECKED FUNCTION, CONSUMER, PREDICATE
•
Million Dollar Question: KPI improvement
• SONAR (detailed examples)
Million Dollar Question: KPI improvement
• Developer Productivity -REPL
• Developer Productivity - IDE support
Million Dollar Question: KPI improvement
• All about GC
Million Dollar Question: KPI improvement
• Ease of testing and performance

Mais conteĂşdo relacionado

Mais procurados

Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvement
Satoshi Akama
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
Databricks
 

Mais procurados (20)

3 things you must know to think reactive - Geecon KrakĂłw 2015
3 things you must know to think reactive - Geecon KrakĂłw 20153 things you must know to think reactive - Geecon KrakĂłw 2015
3 things you must know to think reactive - Geecon KrakĂłw 2015
 
OGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's ViewOGSA-DAI DQP: A Developer's View
OGSA-DAI DQP: A Developer's View
 
Back to the futures, actors and pipes: using Akka for large-scale data migration
Back to the futures, actors and pipes: using Akka for large-scale data migrationBack to the futures, actors and pipes: using Akka for large-scale data migration
Back to the futures, actors and pipes: using Akka for large-scale data migration
 
How LinkedIn Uses Scalding for Data Driven Product Development
How LinkedIn Uses Scalding for Data Driven Product DevelopmentHow LinkedIn Uses Scalding for Data Driven Product Development
How LinkedIn Uses Scalding for Data Driven Product Development
 
Alteryx SDK
Alteryx SDKAlteryx SDK
Alteryx SDK
 
Scala.js for large and complex frontend apps
Scala.js for large and complex frontend appsScala.js for large and complex frontend apps
Scala.js for large and complex frontend apps
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
Programing for problem solving ( airline reservation system)
Programing for problem solving ( airline reservation system)Programing for problem solving ( airline reservation system)
Programing for problem solving ( airline reservation system)
 
Let's Get to the Rapids
Let's Get to the RapidsLet's Get to the Rapids
Let's Get to the Rapids
 
Our challenge for Bulkload reliability improvement
Our challenge for Bulkload reliability  improvementOur challenge for Bulkload reliability  improvement
Our challenge for Bulkload reliability improvement
 
Intro to Akka Streams
Intro to Akka StreamsIntro to Akka Streams
Intro to Akka Streams
 
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
Good and Wicked Fairies, and the Tragedy of the Commons: Understanding the Pe...
 
To kotlin or not to kotlin. That's the question
To kotlin or not to kotlin. That's the questionTo kotlin or not to kotlin. That's the question
To kotlin or not to kotlin. That's the question
 
Collections
CollectionsCollections
Collections
 
What is new in java 8 concurrency
What is new in java 8 concurrencyWhat is new in java 8 concurrency
What is new in java 8 concurrency
 
Streams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The UglyStreams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The Ugly
 
JDK8 Stream api
JDK8 Stream apiJDK8 Stream api
JDK8 Stream api
 
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
From HelloWorld to Configurable and Reusable Apache Spark Applications in Sca...
 
Akka and futures
Akka and futuresAkka and futures
Akka and futures
 
Kotlin decoration - February Berlin Kotlin Meetup
Kotlin decoration - February Berlin Kotlin MeetupKotlin decoration - February Berlin Kotlin Meetup
Kotlin decoration - February Berlin Kotlin Meetup
 

Semelhante a Kpi driven-java-development

JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
Peter Pilgrim
 
Scala 20140715
Scala 20140715Scala 20140715
Scala 20140715
Roger Huang
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
Sages
 

Semelhante a Kpi driven-java-development (20)

JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
 
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
 
Scala 20140715
Scala 20140715Scala 20140715
Scala 20140715
 
Spark what's new what's coming
Spark what's new what's comingSpark what's new what's coming
Spark what's new what's coming
 
Thinking Functionally with JavaScript
Thinking Functionally with JavaScriptThinking Functionally with JavaScript
Thinking Functionally with JavaScript
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark Meetup
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
icpe2019_ishizaki_public
icpe2019_ishizaki_publicicpe2019_ishizaki_public
icpe2019_ishizaki_public
 
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
 
Writing Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using ScaldingWriting Hadoop Jobs in Scala using Scalding
Writing Hadoop Jobs in Scala using Scalding
 
mobl
moblmobl
mobl
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Artigo 81 - spark_tutorial.pdf
Artigo 81 - spark_tutorial.pdfArtigo 81 - spark_tutorial.pdf
Artigo 81 - spark_tutorial.pdf
 
Belfast JUG 23-10-2013
Belfast JUG 23-10-2013Belfast JUG 23-10-2013
Belfast JUG 23-10-2013
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 

Último

valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
SUHANI PANDEY
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
nirzagarg
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
SUHANI PANDEY
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
SUHANI PANDEY
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 

Último (20)

valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 

Kpi driven-java-development

  • 1. KPI driven JAVA(functional) development Gradual journey from imperative to functional development in JAVA Anirban Bhattacharjee – Architect @ Walmart Labs
  • 2. About my functional exposure Writing java for living … since JDK 4 (mostly OO way in the last decade) Came across clojure/scala around 2010…and used in production Learning and using F# since last year @work Occasional tinkering with OCaml and Haskell
  • 3. Problem Statement • We have tons of code written in JAVA • Where will I find developer? • One company one tech stack… • Performance, Monitoring, Support? • Interop, library support. CAN I STILL WRITE FUNCTIONAL CODE, IMPROVE KPI, MAKE MY LEADERSHIP HAPPY
  • 4. Today’s JAVA OOO -> FP Functional programming is mainstream since JDK 8 (GA – 2014) We could use the power of FP ever since then Powerful Lambdas/Streams Collection Enhancements Function, Supplier, Consumer
  • 5. Growing eco-system • Many promising and production ready libraries • Clean APIs • Reduction of verbosity, testable and concise code • Great dev tools • Rapid learning from other functional programming languages
  • 6. KPI improvements (target areas) using FP in java SONAR DEVELOPER PRODUCTIVITY Time to market GC, PERF IMPROVEMENT
  • 7. Journey to FP • Birds eye view of functional java • Additional powerful frameworks  vavr  functional java  streamex  Atlassian fugue  misc…
  • 8. Functional Java : Stream basics Loop List<String> countries = new ArrayList<>(); for (String s : allCountries) { if (s.startsWith(“I")) { countries.add(s); } } Stream List<String> countries = allCountries.stream() .filter(a -> a.startsWith(“I")) .collect(toList())
  • 9. Functional Java : Stream illustrated Origin EndOp 1 Op 2 Op n Data Pipeline Start Data Pipeline End Intermediate Operations
  • 10. Functional Java : Map, reduce, collect List<String> list = Stream.of("India", "Iceland",“Peru“,"Italy") .filter(s -> s.startsWith("I")) .map(String::toUpperCase) .sorted() .collect(toList()) India Iceland ItalyPeru India Iceland Italy INDIA ICELAND ITALY ICELAND INDIA ITALY ICELAND INDIA ITALY 1 2 3 4 5 1 2 3 4 5
  • 11. Intermediate Operation : Filter Ind It UKJP Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK") .filter(s -> s.startsWith("I")); 1 2
  • 12. Functional Java : Intermediate Operation Ind It UKJP Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK") .limit(3); 1 2 JP
  • 13. Functional Java : Intermediate Operation Ind It UKJP Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK", "UK") .distinct(); 1 2 JP UK UK
  • 14. Functional Java : Intermediate Operation Ind It UKUS Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", “US", "UK") .sorted(); 1 2 UK US
  • 15. Functional Java : Intermediate Operation Ind It UKUS Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", “US", "UK") .sorted(Comparator.comparing(String::length)); 1 2 UK US
  • 16. Functional Java : Terminal Operation Ind It UKJP Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK") .forEach(System.out.println()); 1 2 JP UK
  • 17. Functional Java : Downstream Collectors Ind It UKJP Ind It 1 2 Stream<String> startsWithI = Stream.of("Ind", "It", "JP", "UK”, "UK” ) .collect(Collectors.toSet()); 1 2 JP UK UK
  • 18. Functional Java : Custom Downstream collector return Collector.of( () -> new ArrayList<T>(), // supplier (a, e) -> { a.add(e); }, // accumulator (a, b) -> { a.addAll(b); return a; }, // combiner a -> { // finisher a.sort(comp); DA da = downstream.supplier().get(); for (T e : a) downstream.accumulator().accept(da, e); return downstream.finisher().apply(da); }); Stream<Locale> locales = Stream.of(Locale.getAvailableLocales()); var result = locales.collect( groupingBy(Locale::getCountry, mapping(Locale::getDisplayName, sorting(String::compareTo, joining(",")))));
  • 19. Functional Java : Collection enhancemetns map.forEach((k, v) -> System.out.println(k + v));for (Map.Entry<String,String> entry : map.entrySet()) System.out.println(entry.getKey() + entry.getValue()); for (Map.Entry<String,String> entry : map.entrySet()) entry.setValue(entry.getValue().toLowerCase()); map.replaceAll((k, v) -> v.toLowerCase()); map.computeIfAbsent(str, x -> HashsSet::new).add(i);Set<Integer> set = multimap.get(str); if (set == null) { set = new HashSet<>(); multimap.put(str, set); } set.add(i);
  • 20. Functional Java : More Collection Examples Contents
  • 21. Functional Java : Consumer, Supplier, Functions Contents
  • 22. Functional Java : Byte Code • Is Functional java only syntactic sugar? • Byte code improvements • Example of Byte code of BEFORE and AFTER
  • 23. Functional Java : Byte Code • Is Functional java only syntactic sugar? • Byte code improvements • Example of Byte code
  • 24. Vavr
  • 25. Vavr : basics • New functional data-structures (persistent) with superior performance • Pure Functions, monads, superior exception management • Less verbosity • Great Functional semantics
  • 26. Vavr : Examples • LIST, TREE, SET and the cool APIs •
  • 27. Vavr : Examples • CHECKED FUNCTION, CONSUMER, PREDICATE •
  • 28. Vavr : Examples • CHECKED FUNCTION, CONSUMER, PREDICATE •
  • 29. Other frameworks: Streamex, Fugue etc.. • CHECKED FUNCTION, CONSUMER, PREDICATE •
  • 30. Million Dollar Question: KPI improvement • SONAR (detailed examples)
  • 31. Million Dollar Question: KPI improvement • Developer Productivity -REPL • Developer Productivity - IDE support
  • 32. Million Dollar Question: KPI improvement • All about GC
  • 33. Million Dollar Question: KPI improvement • Ease of testing and performance