SlideShare a Scribd company logo
1 of 21
Download to read offline
Challenges of moving
a Java team to Scala
João Cavalheiro
joao.cavalheiro@enear.co
About me
• 10 years professional experience as a developer
in multiple languages (from C to Java).
• Working at E.near, as a Systems Architect and
managing 3 Scala development teams.
Outline
• Why move a Java team to Scala?
• The challenges
• The good things
This is not about
• An introduction to Scala language.
• Convincing Java fans to move to Scala.
• Migrating Java code to Scala.
The motivation
• A customer asked us to take control of a big
Scala project (+200k lines of code), already in
production at the time.
• Time was short.
• We said we would do it!
• We needed the right team and a plan…
The right team
• Not every Java developer can be “converted” to
Scala.
• Although professional Scala experience is not
required, functional programming concepts are
a “must have”.
• Team members must embrace Scala - happy
engineers are essential.
Scala features that
sometimes scare Java
developers
And how to deal with them
Infix and Postfix operations
• object.operation(k) can be written as
“object operation k”
• object.operation can be written as
“object operation”.
• Try not to mix them with traditional object-
oriented programming language syntax.
High order functions
• These are functions that take other functions as
parameters, or whose result is a function.
• def hof(f: Int => String, v: Int) = f(v)
• Use them whenever it makes sense (and once
you feel comfortable with the concept).
Implicit conversions
• Given the declaration “implicit convert(a:A):B”.
• “convert” will be called behind the scenes
whenever you have an “A” and need a “B”.
• Don’t use it before you understand the
consequences.
How to start
Once you have the right people aboard
First steps
• Start by writing tests.
• Don’t feel guilty for using OO design in your first
days in Scala.
• You don't have to understand all the possibilities
when starting.
Build tools
• You can use Maven, but…
• SBT basics are easy to learn.
• Although not as mature as Maven, works better
with Scala.
• SBT supports incremental compilation out of the
box.
Scala ecosystem
• Typesafe activator
• The play framework
• Lots of online documentation:
• http://www.scala-lang.org/
• Stack overflow
Express yourself
• Simply express your intent.
• Write readable code. Shorter code is not always
a best option.
• There are lots of toys, try to use only the right
ones.
Things we loved about
Scala since the first day
And that made things easier
REPL
!
!
!
• REPL is an interactive Scala command line
interpreter.
• Awesome for doing experiments!
Tools, libs & runtime
environment
• Compiled Scala is like compiled Java -
Bytecode that runs on JVM.
• We can use all our favourite Java libs.
• We can use our favourite IDE (Scala / IntelliJ),
and the debugger works!
Class constructors
!
!
!
!
Pattern matching
!
!
!
!
Conclusions
• Myth: We don’t need frameworks.
• Myth: Java sucks, and Java coders aren’t as
smart as us.
• More concise code.
• Less time coding.
• Less bugs, if you do it right.

More Related Content

What's hot

Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)
Tony Tam
 
Jira and Confluence - How the company behind those products works - Anatoli K...
Jira and Confluence - How the company behind those products works - Anatoli K...Jira and Confluence - How the company behind those products works - Anatoli K...
Jira and Confluence - How the company behind those products works - Anatoli K...
Dominic Trần
 

What's hot (20)

Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...
Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...
Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...
 
Can you TDD Rails?
Can you TDD Rails?Can you TDD Rails?
Can you TDD Rails?
 
Tdd final submission
Tdd final submissionTdd final submission
Tdd final submission
 
Episode 2 conditional flows & loops
Episode 2   conditional flows & loopsEpisode 2   conditional flows & loops
Episode 2 conditional flows & loops
 
Rails automatic test driven development
Rails automatic test driven developmentRails automatic test driven development
Rails automatic test driven development
 
"GitHub com for lazy in cloud project management" by Sergejs Matancevs from S...
"GitHub com for lazy in cloud project management" by Sergejs Matancevs from S..."GitHub com for lazy in cloud project management" by Sergejs Matancevs from S...
"GitHub com for lazy in cloud project management" by Sergejs Matancevs from S...
 
Cassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To BeCassandra Summit 2014: Astyanax — To Be or Not To Be
Cassandra Summit 2014: Astyanax — To Be or Not To Be
 
Episode 22 - Design Pattern 2
Episode 22 - Design Pattern 2Episode 22 - Design Pattern 2
Episode 22 - Design Pattern 2
 
The Big Wave of Indian Startups - Almost Effortless Entrepreneurship Using Ruby
The Big Wave of Indian Startups - Almost Effortless Entrepreneurship Using RubyThe Big Wave of Indian Startups - Almost Effortless Entrepreneurship Using Ruby
The Big Wave of Indian Startups - Almost Effortless Entrepreneurship Using Ruby
 
Airbnb Java Script style guide
Airbnb Java Script style guideAirbnb Java Script style guide
Airbnb Java Script style guide
 
An Introduction to jOOQ
An Introduction to jOOQAn Introduction to jOOQ
An Introduction to jOOQ
 
Developing Amazon Alexa Skills with the Go Programming Language
Developing Amazon Alexa Skills with the Go Programming LanguageDeveloping Amazon Alexa Skills with the Go Programming Language
Developing Amazon Alexa Skills with the Go Programming Language
 
Reactive All the Way Down the Stack
Reactive All the Way Down the StackReactive All the Way Down the Stack
Reactive All the Way Down the Stack
 
London Atlassian User Group - February 2014
London Atlassian User Group - February 2014London Atlassian User Group - February 2014
London Atlassian User Group - February 2014
 
Voice Applications (Alexa Skills) Cloud Native on Kubernetes with Terraform
Voice Applications (Alexa Skills) Cloud Native on Kubernetes with TerraformVoice Applications (Alexa Skills) Cloud Native on Kubernetes with Terraform
Voice Applications (Alexa Skills) Cloud Native on Kubernetes with Terraform
 
Agile Apps with App Engine
Agile Apps with App EngineAgile Apps with App Engine
Agile Apps with App Engine
 
Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)
 
Jira and Confluence - How the company behind those products works - Anatoli K...
Jira and Confluence - How the company behind those products works - Anatoli K...Jira and Confluence - How the company behind those products works - Anatoli K...
Jira and Confluence - How the company behind those products works - Anatoli K...
 
Next generation frontend tooling
Next generation frontend toolingNext generation frontend tooling
Next generation frontend tooling
 
Greach 2018: Surviving Microservices
Greach 2018: Surviving MicroservicesGreach 2018: Surviving Microservices
Greach 2018: Surviving Microservices
 

Similar to Challenges of moving a java team to scala

Similar to Challenges of moving a java team to scala (20)

From java to scala at crowd mix
From java to scala at crowd mixFrom java to scala at crowd mix
From java to scala at crowd mix
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Java to scala
Java to scalaJava to scala
Java to scala
 
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGNIntroducing Scala to your Ruby/Java Shop : My experiences at IGN
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
 
basic core java up to operator
basic core java up to operatorbasic core java up to operator
basic core java up to operator
 
Java to Scala: Why & How
Java to Scala: Why & HowJava to Scala: Why & How
Java to Scala: Why & How
 
Using Apache Camel as AKKA
Using Apache Camel as AKKAUsing Apache Camel as AKKA
Using Apache Camel as AKKA
 
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
DevQA: make your testers happier with Groovy, Spock and Geb (Greach 2014)
 
Installing spark scala console in windows 10
Installing spark scala console in windows 10Installing spark scala console in windows 10
Installing spark scala console in windows 10
 
Introduction to Scala language
Introduction to Scala languageIntroduction to Scala language
Introduction to Scala language
 
Software Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with ScalaSoftware Engineering Thailand: Programming with Scala
Software Engineering Thailand: Programming with Scala
 
DevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and GebDevQA: make your testers happier with Groovy, Spock and Geb
DevQA: make your testers happier with Groovy, Spock and Geb
 
Java (1)
Java (1)Java (1)
Java (1)
 
Evolving IGN’s New APIs with Scala
 Evolving IGN’s New APIs with Scala Evolving IGN’s New APIs with Scala
Evolving IGN’s New APIs with Scala
 
Frontend as a first class citizen
Frontend as a first class citizenFrontend as a first class citizen
Frontend as a first class citizen
 
OOP - Lecture02 - Introduction to Java.pptx
OOP - Lecture02 - Introduction to Java.pptxOOP - Lecture02 - Introduction to Java.pptx
OOP - Lecture02 - Introduction to Java.pptx
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Whitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to ReactiveWhitepages Practical Experience Converting from Ruby to Reactive
Whitepages Practical Experience Converting from Ruby to Reactive
 
OOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptxOOP Lecture 1-Intro to Java.pptx
OOP Lecture 1-Intro to Java.pptx
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 

Challenges of moving a java team to scala

  • 1. Challenges of moving a Java team to Scala João Cavalheiro joao.cavalheiro@enear.co
  • 2. About me • 10 years professional experience as a developer in multiple languages (from C to Java). • Working at E.near, as a Systems Architect and managing 3 Scala development teams.
  • 3. Outline • Why move a Java team to Scala? • The challenges • The good things
  • 4. This is not about • An introduction to Scala language. • Convincing Java fans to move to Scala. • Migrating Java code to Scala.
  • 5. The motivation • A customer asked us to take control of a big Scala project (+200k lines of code), already in production at the time. • Time was short. • We said we would do it! • We needed the right team and a plan…
  • 6. The right team • Not every Java developer can be “converted” to Scala. • Although professional Scala experience is not required, functional programming concepts are a “must have”. • Team members must embrace Scala - happy engineers are essential.
  • 7. Scala features that sometimes scare Java developers And how to deal with them
  • 8. Infix and Postfix operations • object.operation(k) can be written as “object operation k” • object.operation can be written as “object operation”. • Try not to mix them with traditional object- oriented programming language syntax.
  • 9. High order functions • These are functions that take other functions as parameters, or whose result is a function. • def hof(f: Int => String, v: Int) = f(v) • Use them whenever it makes sense (and once you feel comfortable with the concept).
  • 10. Implicit conversions • Given the declaration “implicit convert(a:A):B”. • “convert” will be called behind the scenes whenever you have an “A” and need a “B”. • Don’t use it before you understand the consequences.
  • 11. How to start Once you have the right people aboard
  • 12. First steps • Start by writing tests. • Don’t feel guilty for using OO design in your first days in Scala. • You don't have to understand all the possibilities when starting.
  • 13. Build tools • You can use Maven, but… • SBT basics are easy to learn. • Although not as mature as Maven, works better with Scala. • SBT supports incremental compilation out of the box.
  • 14. Scala ecosystem • Typesafe activator • The play framework • Lots of online documentation: • http://www.scala-lang.org/ • Stack overflow
  • 15. Express yourself • Simply express your intent. • Write readable code. Shorter code is not always a best option. • There are lots of toys, try to use only the right ones.
  • 16. Things we loved about Scala since the first day And that made things easier
  • 17. REPL ! ! ! • REPL is an interactive Scala command line interpreter. • Awesome for doing experiments!
  • 18. Tools, libs & runtime environment • Compiled Scala is like compiled Java - Bytecode that runs on JVM. • We can use all our favourite Java libs. • We can use our favourite IDE (Scala / IntelliJ), and the debugger works!
  • 21. Conclusions • Myth: We don’t need frameworks. • Myth: Java sucks, and Java coders aren’t as smart as us. • More concise code. • Less time coding. • Less bugs, if you do it right.