SlideShare a Scribd company logo
1 of 14
Download to read offline
Embracing Clojure
A journey into Clojure adoption
LambdaCon
2015-3-28, Bologna, Italy
Luca Grulla
Back in 2012 we had…
• A new product idea
• Lean team: 2 developers
• both with 10+ years of experience
• both polyglot
• no Functional Programming experience
Product Architecture
Website AggregatorJson
{
name: "Luca"
claims: []
address: "42 Magic Road"
abi: "123456"}
[{"premium": "150", "brand": “foo"}
{"premium":"180", "brand":"blah"}]
xml
xml
xml
xml
xml
insurer#1
insurer#4
insurer#2
insurer#3
insurer#5
Why Clojure?
• The problem we had to solve was data
transformation: FP was a pretty good match
• Mature stack(JVM, repos, Java libraries)
• Language with huge growth potentials
• Strong Clojure support within the organisation
~$ lein new aggregator
Challenge #1: Emacs
Steep learning curve
Challenge #2: read LISP
(def my-vector [{:val 8} {:val 33} {:val 42} {:val 13}])
(* (reduce + (map :val (filter(fn[y] (< (:val y) 20)) my-vector)))
2) ;;42
Epiphany #1: threading
macro for local pipelines
(->>
my-vector
(filter (fn[y] (< (:val y) 20)))
(map :val)
(reduce +)
(* 2)) ;;42
(* (reduce + (map :val (filter(fn[y] (< (:val y) 20)) my-vector)))
2) ;;42
(->> x & forms)
Challenge #3: idiomatic
Clojure
(def people [{:name "Luca" :nationality “Italian"}
{:name "Tim" :nationality “Canadian"}
{:name "Davie" :nationality “British"}
{:name "David" :nationality “Belgian"}
{:name "Mike" :nationality "British"}])
(filter not-italian? people)
(defn not-italian?[p] (not= "Italian" (:nationality p)))
(filter (fn[p] (not= "Italian" (:nationality p))) people)
(filter (fn[p] (not= "British" (:nationality p))) people)
Epiphany #2: function
composition
(defn not?[nationality p] (not= nationality (:nationality p)))
(filter (partial not? "Italian") people)
(partial f arg1)
Epiphany #3: functions are
first class citizens
Everything is geared toward functions creation and
composition
Epiphany #4: parallelism
made easy
(def request-func [partner-1-func partner-2-func partner-3-func])
(pmap #(apply % []) request-func) ;;hardware bound(num of processors +2)
(map #(future (apply % [])) request-func) ;;collection of futures
clojure.core.async
tl;dr
• If you are doing some sort of data transformation you
should look at Clojure
• Clojure code is terse and expressive
• Mature ecosystem: JVM, repos, libraries
• Personal growth: people are challenged by the new
paradigm, solid CS concepts took back into the game
• Business impact: functional composition + parallelism
will give you a competitive advantage
@lucagrulla
www.lucagrulla.it
Questions?
we’re hiring!! http://www.uswitch.com/careers/

More Related Content

Viewers also liked

Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)Howard Lewis Ship
 
Ring: Web Apps in Idiomatic Clojure
Ring: Web Apps in Idiomatic ClojureRing: Web Apps in Idiomatic Clojure
Ring: Web Apps in Idiomatic ClojureMark McGranaghan
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Stefan Richter
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of AbstractionAlex Miller
 
Machine Learning to Grow the World's Knowledge
Machine Learning to Grow  the World's KnowledgeMachine Learning to Grow  the World's Knowledge
Machine Learning to Grow the World's KnowledgeXavier Amatriain
 
DAMA Webinar - Big and Little Data Quality
DAMA Webinar - Big and Little Data QualityDAMA Webinar - Big and Little Data Quality
DAMA Webinar - Big and Little Data QualityDATAVERSITY
 
Visualising Data with Code
Visualising Data with CodeVisualising Data with Code
Visualising Data with CodeRi Liu
 
GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science Domino Data Lab
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with DataSeth Familian
 

Viewers also liked (10)

Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
Clojure: Towards The Essence Of Programming (What's Next? Conference, May 2011)
 
Ring: Web Apps in Idiomatic Clojure
Ring: Web Apps in Idiomatic ClojureRing: Web Apps in Idiomatic Clojure
Ring: Web Apps in Idiomatic Clojure
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
Using Clojure, NoSQL Databases and Functional-Style JavaScript to Write Gext-...
 
Clojure: The Art of Abstraction
Clojure: The Art of AbstractionClojure: The Art of Abstraction
Clojure: The Art of Abstraction
 
Machine Learning to Grow the World's Knowledge
Machine Learning to Grow  the World's KnowledgeMachine Learning to Grow  the World's Knowledge
Machine Learning to Grow the World's Knowledge
 
DAMA Webinar - Big and Little Data Quality
DAMA Webinar - Big and Little Data QualityDAMA Webinar - Big and Little Data Quality
DAMA Webinar - Big and Little Data Quality
 
Visualising Data with Code
Visualising Data with CodeVisualising Data with Code
Visualising Data with Code
 
GPU Computing for Data Science
GPU Computing for Data Science GPU Computing for Data Science
GPU Computing for Data Science
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 

Similar to Embracing Clojure: a journey into Clojure adoption

Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBMongoDB
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLLuka Jacobowitz
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?intelliyole
 
The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210Mahmoud Samir Fayed
 
20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptx20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptxDianeKesler1
 
Kotlin for android 2019
Kotlin for android 2019Kotlin for android 2019
Kotlin for android 2019Shady Selim
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerGarth Gilmour
 
TypeScript Vs. KotlinJS
TypeScript Vs. KotlinJSTypeScript Vs. KotlinJS
TypeScript Vs. KotlinJSGarth Gilmour
 
The Ring programming language version 1.5.4 book - Part 11 of 185
The Ring programming language version 1.5.4 book - Part 11 of 185The Ring programming language version 1.5.4 book - Part 11 of 185
The Ring programming language version 1.5.4 book - Part 11 of 185Mahmoud Samir Fayed
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android UpdateGarth Gilmour
 
The Ring programming language version 1.10 book - Part 18 of 212
The Ring programming language version 1.10 book - Part 18 of 212The Ring programming language version 1.10 book - Part 18 of 212
The Ring programming language version 1.10 book - Part 18 of 212Mahmoud Samir Fayed
 
C++11 Was Only the Beginning
C++11 Was Only the BeginningC++11 Was Only the Beginning
C++11 Was Only the BeginningMateusz Pusz
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshopAssaf Gannon
 
The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202Mahmoud Samir Fayed
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Embarcadero Technologies
 
Experiences Building InfluxDB in Go
Experiences Building InfluxDB in GoExperiences Building InfluxDB in Go
Experiences Building InfluxDB in GoC4Media
 
The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212Mahmoud Samir Fayed
 
Wicket In Action - oredev2008
Wicket In Action - oredev2008Wicket In Action - oredev2008
Wicket In Action - oredev2008Martijn Dashorst
 

Similar to Embracing Clojure: a journey into Clojure adoption (20)

C# 6
C# 6C# 6
C# 6
 
Fast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDBFast REST APIs Development with MongoDB
Fast REST APIs Development with MongoDB
 
F sharp - an overview
F sharp - an overviewF sharp - an overview
F sharp - an overview
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGL
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?
 
The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210The Ring programming language version 1.9 book - Part 17 of 210
The Ring programming language version 1.9 book - Part 17 of 210
 
20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptx20230721_OKC_Meetup_MuleSoft.pptx
20230721_OKC_Meetup_MuleSoft.pptx
 
Kotlin for android 2019
Kotlin for android 2019Kotlin for android 2019
Kotlin for android 2019
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
TypeScript Vs. KotlinJS
TypeScript Vs. KotlinJSTypeScript Vs. KotlinJS
TypeScript Vs. KotlinJS
 
The Ring programming language version 1.5.4 book - Part 11 of 185
The Ring programming language version 1.5.4 book - Part 11 of 185The Ring programming language version 1.5.4 book - Part 11 of 185
The Ring programming language version 1.5.4 book - Part 11 of 185
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android Update
 
The Ring programming language version 1.10 book - Part 18 of 212
The Ring programming language version 1.10 book - Part 18 of 212The Ring programming language version 1.10 book - Part 18 of 212
The Ring programming language version 1.10 book - Part 18 of 212
 
C++11 Was Only the Beginning
C++11 Was Only the BeginningC++11 Was Only the Beginning
C++11 Was Only the Beginning
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202The Ring programming language version 1.8 book - Part 15 of 202
The Ring programming language version 1.8 book - Part 15 of 202
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework
 
Experiences Building InfluxDB in Go
Experiences Building InfluxDB in GoExperiences Building InfluxDB in Go
Experiences Building InfluxDB in Go
 
The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212
 
Wicket In Action - oredev2008
Wicket In Action - oredev2008Wicket In Action - oredev2008
Wicket In Action - oredev2008
 

More from Luca Grulla

Change a gear up with Evolutionary Architecture
Change a gear up with Evolutionary ArchitectureChange a gear up with Evolutionary Architecture
Change a gear up with Evolutionary ArchitectureLuca Grulla
 
Impact! Drive innovation from the front seat
Impact!  Drive innovation from the front seatImpact!  Drive innovation from the front seat
Impact! Drive innovation from the front seatLuca Grulla
 
Clojure's killer design decisions
Clojure's killer design decisionsClojure's killer design decisions
Clojure's killer design decisionsLuca Grulla
 
Transmitting Signal with Clojure
Transmitting Signal with ClojureTransmitting Signal with Clojure
Transmitting Signal with ClojureLuca Grulla
 
Innovation at speed
Innovation at speedInnovation at speed
Innovation at speedLuca Grulla
 
Javascript testing IAD2010
Javascript testing IAD2010Javascript testing IAD2010
Javascript testing IAD2010Luca Grulla
 
Agile Estimating And Planning
Agile Estimating And PlanningAgile Estimating And Planning
Agile Estimating And PlanningLuca Grulla
 
Retrospectives Techniques
Retrospectives TechniquesRetrospectives Techniques
Retrospectives TechniquesLuca Grulla
 

More from Luca Grulla (8)

Change a gear up with Evolutionary Architecture
Change a gear up with Evolutionary ArchitectureChange a gear up with Evolutionary Architecture
Change a gear up with Evolutionary Architecture
 
Impact! Drive innovation from the front seat
Impact!  Drive innovation from the front seatImpact!  Drive innovation from the front seat
Impact! Drive innovation from the front seat
 
Clojure's killer design decisions
Clojure's killer design decisionsClojure's killer design decisions
Clojure's killer design decisions
 
Transmitting Signal with Clojure
Transmitting Signal with ClojureTransmitting Signal with Clojure
Transmitting Signal with Clojure
 
Innovation at speed
Innovation at speedInnovation at speed
Innovation at speed
 
Javascript testing IAD2010
Javascript testing IAD2010Javascript testing IAD2010
Javascript testing IAD2010
 
Agile Estimating And Planning
Agile Estimating And PlanningAgile Estimating And Planning
Agile Estimating And Planning
 
Retrospectives Techniques
Retrospectives TechniquesRetrospectives Techniques
Retrospectives Techniques
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
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
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
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
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
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...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
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...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Embracing Clojure: a journey into Clojure adoption

  • 1. Embracing Clojure A journey into Clojure adoption LambdaCon 2015-3-28, Bologna, Italy Luca Grulla
  • 2. Back in 2012 we had… • A new product idea • Lean team: 2 developers • both with 10+ years of experience • both polyglot • no Functional Programming experience
  • 3. Product Architecture Website AggregatorJson { name: "Luca" claims: [] address: "42 Magic Road" abi: "123456"} [{"premium": "150", "brand": “foo"} {"premium":"180", "brand":"blah"}] xml xml xml xml xml insurer#1 insurer#4 insurer#2 insurer#3 insurer#5
  • 4. Why Clojure? • The problem we had to solve was data transformation: FP was a pretty good match • Mature stack(JVM, repos, Java libraries) • Language with huge growth potentials • Strong Clojure support within the organisation
  • 5. ~$ lein new aggregator
  • 6. Challenge #1: Emacs Steep learning curve
  • 7. Challenge #2: read LISP (def my-vector [{:val 8} {:val 33} {:val 42} {:val 13}]) (* (reduce + (map :val (filter(fn[y] (< (:val y) 20)) my-vector))) 2) ;;42
  • 8. Epiphany #1: threading macro for local pipelines (->> my-vector (filter (fn[y] (< (:val y) 20))) (map :val) (reduce +) (* 2)) ;;42 (* (reduce + (map :val (filter(fn[y] (< (:val y) 20)) my-vector))) 2) ;;42 (->> x & forms)
  • 9. Challenge #3: idiomatic Clojure (def people [{:name "Luca" :nationality “Italian"} {:name "Tim" :nationality “Canadian"} {:name "Davie" :nationality “British"} {:name "David" :nationality “Belgian"} {:name "Mike" :nationality "British"}]) (filter not-italian? people) (defn not-italian?[p] (not= "Italian" (:nationality p))) (filter (fn[p] (not= "Italian" (:nationality p))) people) (filter (fn[p] (not= "British" (:nationality p))) people)
  • 10. Epiphany #2: function composition (defn not?[nationality p] (not= nationality (:nationality p))) (filter (partial not? "Italian") people) (partial f arg1)
  • 11. Epiphany #3: functions are first class citizens Everything is geared toward functions creation and composition
  • 12. Epiphany #4: parallelism made easy (def request-func [partner-1-func partner-2-func partner-3-func]) (pmap #(apply % []) request-func) ;;hardware bound(num of processors +2) (map #(future (apply % [])) request-func) ;;collection of futures clojure.core.async
  • 13. tl;dr • If you are doing some sort of data transformation you should look at Clojure • Clojure code is terse and expressive • Mature ecosystem: JVM, repos, libraries • Personal growth: people are challenged by the new paradigm, solid CS concepts took back into the game • Business impact: functional composition + parallelism will give you a competitive advantage