SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Feedbacks from the trenches
François ARMAND @fanf42 - 2016-10
?
Who knows...
?
?JdbcTemplate
Who knows...
?
?JdbcTemplate
?
Who knows...
?
Anorm ??
Who knows...
?JdbcTemplate
?
Anorm ?
Squeryl ? ?JdbcTemplate
?
Who knows...
?
Anorm ?
Squeryl ? ?JdbcTemplate
?
?
Who knows...
?
Anorm ?
Squeryl ? ?JdbcTemplate
?
?
SQL?
Who knows...
OBJECT
MAPPING
PURE
SQL
?
Anorm ?
Squeryl ? ?JdbcTemplate
?
?
SQL?
Love SQL ?
Who knows...
Who’s talkin’ for why?
● 10 years of Scala
● CTO @Normation
● Lead-dev on Rudder
● chose Scala 7y ago for Rudder
Continuous Configuration
for Effective ComplianceFrançois ARMAND / @fanf42
● 10 years of Scala
● CTO @Normation
● Lead-dev on Rudder
● chose Scala 7y ago for Rudder
Continuous Configuration
for Effective Compliance
Squeryl
François ARMAND / @fanf42
Who’s talkin’ for why?
● 10 years of Scala
● CTO @Normation
● Lead-dev on Rudder
● chose Scala 7y ago for Rudder
Continuous Configuration
for Effective Compliance
Squeryl
JdbcTemplate
François ARMAND / @fanf42
Who’s talkin’ for why?
But what ?
● 10 years of Scala
● CTO @Normation
● Lead-dev on Rudder
● chose Scala 7y ago for Rudder
Continuous Configuration
for Effective Compliance
Squeryl
JdbcTemplate
François ARMAND / @fanf42
Who’s talkin’ for why?
Slick 3 ?
● Fairly popular, ~ default choice in 2016 for Scala world
● Let’s test it ! ⇒ ported ~ 50% of Rudder code to it.
● Fairly popular, ~ default choice in 2016 for Scala world
● Let’s test it ! ⇒ ported ~ 50% of Rudder code to it.
● Does not work for us :
● Feels magic and ORM-y, with *Surprises*
○ in generated SQL
■ you can’t precisely control it (that’s the point)
○ in performance (using path of least resistance)
■ ex: run-time compilation for EACH request in the path of least resistance
○ with lift embeding type
■ i.e working with Rep[MyClass] in place of MyClass
● An awful lot of boilerplate
Slick 3 ?
Doobie ?
Use Doobie.
It’s GREAT.
Doobie
Use Doobie.
It’s GREAT.
Questions ?
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
● Mapping is a joy (actually make me smile)
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
● Mapping is a joy (actually make me smile)
● No surprises :
○ it just works as expected.
○ Performance are ~ raw JDBC.
○ NO JDBC part is beyond reach.
■ Even dirty things about JDBC connection like SQLXML. Or variable number of params.
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
● Mapping is a joy (actually make me smile)
● No surprises :
○ it just works as expected.
○ Performance are ~ raw JDBC.
○ NO JDBC part is beyond reach.
■ Even dirty things about JDBC connection like SQLXML. Or variable number of params.
● Rob Norris (@tpolecat) is über nice and helpful
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
● Mapping is a joy (actually make me smile)
● No surprises :
○ it just works as expected.
○ Performance are ~ raw JDBC.
○ NO JDBC part is beyond reach.
■ Even dirty things about JDBC connection like SQLXML. Or variable number of params.
● Rob Norris (@tpolecat) is über nice and helpful
● It actually makes me like SQL
○ (it tooks 15 years, and PostgreSQL helps a lot)
Doobie
Use Doobie.
It’s GREAT.
● A pure functional database access layer for Scala
● Mapping is a joy (actually make me smile)
● No surprises :
○ it just works as expected.
○ Performance are ~ raw JDBC.
○ NO JDBC part is beyond reach.
■ Even dirty things about JDBC connection like SQLXML. Or variable number of params.
● Rob Norris (@tpolecat) is über nice and helpful
● It actually makes me like SQL
○ (it tooks 15 years, and PostgreSQL helps a lot)
Doobie
A pure functional database access layer for Scala
● everything is a value
● standard functional programming idioms apply
● Clear separation of concepts
○ (I won’t talk about Free Monad - oups)
Mapping just works. Returns what you want.
Mapping just works. No boilerplate.
Mapping just works. No boilerplate.
Mapping just works. No boilerplate.
Performance (especially in pure FP) matters
● The exact, 50 lines if you want,
SQL queries you want to write.
● PreparedStatement by default.
● Batch updates are given.
● Comparison with JDBC
Rob Norris @tpolecat
(like, he produced working code for SQLXML mapping. At 3 a.m. Just for me)
(OK, 3 a.m for my timezone. But still :)
is
extremely
nice and
helpful
actually
likes SQL
Yes. Really.
Savant word for
“Makes you love SQL -
No surprise, it just works”
Questions ?
The End
Testing mapping in the repl
References
● Book of Doobie : https://tpolecat.github.io/doobie-0.3.0/00-index.html
● Really nice presentation of concepts:
○ SBTB 2015: Rob Norris, Programs as Values: JDBC Programming with Doobie
■ https://www.youtube.com/watch?v=M5MF6M7FHPo
● https://twitter.com/tpolecat
● https://gitter.im/tpolecat/doobie

Weitere ähnliche Inhalte

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 

Empfohlen

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Doobie : Un JDBC fonctionnel qui ne cache pas SQL

  • 1. Feedbacks from the trenches François ARMAND @fanf42 - 2016-10
  • 6. ? Anorm ? Squeryl ? ?JdbcTemplate ? Who knows...
  • 7. ? Anorm ? Squeryl ? ?JdbcTemplate ? ? Who knows...
  • 8. ? Anorm ? Squeryl ? ?JdbcTemplate ? ? SQL? Who knows... OBJECT MAPPING PURE SQL
  • 9. ? Anorm ? Squeryl ? ?JdbcTemplate ? ? SQL? Love SQL ? Who knows...
  • 10. Who’s talkin’ for why? ● 10 years of Scala ● CTO @Normation ● Lead-dev on Rudder ● chose Scala 7y ago for Rudder Continuous Configuration for Effective ComplianceFrançois ARMAND / @fanf42
  • 11. ● 10 years of Scala ● CTO @Normation ● Lead-dev on Rudder ● chose Scala 7y ago for Rudder Continuous Configuration for Effective Compliance Squeryl François ARMAND / @fanf42 Who’s talkin’ for why?
  • 12. ● 10 years of Scala ● CTO @Normation ● Lead-dev on Rudder ● chose Scala 7y ago for Rudder Continuous Configuration for Effective Compliance Squeryl JdbcTemplate François ARMAND / @fanf42 Who’s talkin’ for why?
  • 13. But what ? ● 10 years of Scala ● CTO @Normation ● Lead-dev on Rudder ● chose Scala 7y ago for Rudder Continuous Configuration for Effective Compliance Squeryl JdbcTemplate François ARMAND / @fanf42 Who’s talkin’ for why?
  • 14. Slick 3 ? ● Fairly popular, ~ default choice in 2016 for Scala world ● Let’s test it ! ⇒ ported ~ 50% of Rudder code to it.
  • 15. ● Fairly popular, ~ default choice in 2016 for Scala world ● Let’s test it ! ⇒ ported ~ 50% of Rudder code to it. ● Does not work for us : ● Feels magic and ORM-y, with *Surprises* ○ in generated SQL ■ you can’t precisely control it (that’s the point) ○ in performance (using path of least resistance) ■ ex: run-time compilation for EACH request in the path of least resistance ○ with lift embeding type ■ i.e working with Rep[MyClass] in place of MyClass ● An awful lot of boilerplate Slick 3 ?
  • 19. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala Doobie
  • 20. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala ● Mapping is a joy (actually make me smile) Doobie
  • 21. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala ● Mapping is a joy (actually make me smile) ● No surprises : ○ it just works as expected. ○ Performance are ~ raw JDBC. ○ NO JDBC part is beyond reach. ■ Even dirty things about JDBC connection like SQLXML. Or variable number of params. Doobie
  • 22. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala ● Mapping is a joy (actually make me smile) ● No surprises : ○ it just works as expected. ○ Performance are ~ raw JDBC. ○ NO JDBC part is beyond reach. ■ Even dirty things about JDBC connection like SQLXML. Or variable number of params. ● Rob Norris (@tpolecat) is über nice and helpful Doobie
  • 23. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala ● Mapping is a joy (actually make me smile) ● No surprises : ○ it just works as expected. ○ Performance are ~ raw JDBC. ○ NO JDBC part is beyond reach. ■ Even dirty things about JDBC connection like SQLXML. Or variable number of params. ● Rob Norris (@tpolecat) is über nice and helpful ● It actually makes me like SQL ○ (it tooks 15 years, and PostgreSQL helps a lot) Doobie
  • 24. Use Doobie. It’s GREAT. ● A pure functional database access layer for Scala ● Mapping is a joy (actually make me smile) ● No surprises : ○ it just works as expected. ○ Performance are ~ raw JDBC. ○ NO JDBC part is beyond reach. ■ Even dirty things about JDBC connection like SQLXML. Or variable number of params. ● Rob Norris (@tpolecat) is über nice and helpful ● It actually makes me like SQL ○ (it tooks 15 years, and PostgreSQL helps a lot) Doobie
  • 25. A pure functional database access layer for Scala ● everything is a value ● standard functional programming idioms apply ● Clear separation of concepts ○ (I won’t talk about Free Monad - oups)
  • 26. Mapping just works. Returns what you want.
  • 27. Mapping just works. No boilerplate.
  • 28. Mapping just works. No boilerplate.
  • 29. Mapping just works. No boilerplate.
  • 30. Performance (especially in pure FP) matters ● The exact, 50 lines if you want, SQL queries you want to write. ● PreparedStatement by default. ● Batch updates are given. ● Comparison with JDBC
  • 31. Rob Norris @tpolecat (like, he produced working code for SQLXML mapping. At 3 a.m. Just for me) (OK, 3 a.m for my timezone. But still :) is extremely nice and helpful actually likes SQL
  • 32. Yes. Really. Savant word for “Makes you love SQL - No surprise, it just works” Questions ? The End
  • 33. Testing mapping in the repl
  • 34. References ● Book of Doobie : https://tpolecat.github.io/doobie-0.3.0/00-index.html ● Really nice presentation of concepts: ○ SBTB 2015: Rob Norris, Programs as Values: JDBC Programming with Doobie ■ https://www.youtube.com/watch?v=M5MF6M7FHPo ● https://twitter.com/tpolecat ● https://gitter.im/tpolecat/doobie