SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Scala in the Wild
Tomer Gabel, JavaOne 2015
Agenda
• Scala in a nutshell
• Bootstrapping
• Practical
Considerations
• Ecosystem
• Call to action
Who is this guy?
Me
• System architect at Wix
• Scala user since 2011
• User group leader:
– Underscore (Scala)
– Java.IL (Java/JVM)
• Organizer of Scalapeño
Who is this guy?
Me
• System architect at Wix
• Scala user since 2011
• User group leader:
– Underscore (Scala)
– Java.IL (Java/JVM)
• Organizer of Scalapeño
Wix
• >70M sites
• Scala shop since 2012
• The usual suspects:
– Microservices
– Continuous delivery
– Legacy Java codebase
SCALA IN A
NUTSHELL
Recap
• You’ve heard it all before!
– Statically-typed
– Targets the JVM
– … and JavaScript, and Android
– Hybrid object-oriented/functional
– Ponies, unicorns, yada yada yada
Executive Summary
A better Java
• Less boilerplate
• Less baggage
• Less old and boring
• New toys to play with
• ⇒ Happier developers
Executive Summary
A better Java
• Less boilerplate
• Less baggage
• Less old and boring
• New toys to play with
• ⇒ Happier developers
Gateway drug to
Haskell
• Can be functional
• ... if you want it to
• Better abstractions
Executive Summary
A better Java
• Less boilerplate
• Less baggage
• Less old and boring
Gateway drug to
Haskell
• Can be functional
• ... if you want it to
• Better abstractions
• New toys to play with
• ⇒ Happier developers
The Fineprint
• Warts
– Compilation times
– Imperfect IDEs
– Documentation
– Debugging*
• Semi-known quantity
– Still pretty new
– Few best practices
– No style guide
– New ⇒ prone to abuse
Bootstrapping
Gimme Three Steps
IntelliJ IDEA
NetBeans
Eclipse
gradle
maven
ant
1. Stick with what you know
Gimme Three Steps
Hibernate
Guava/Guice
Spring
2. Grow a hybrid codebase
• Mix Scala/Java freely!
– Same codebase
– Same libraries
– A single runtime
dependency!
Gimme Three Steps
3. Keep it simple
• You don’t have to go all in
• In fact, you probably shouldn’t:
– Language mastery takes time
– Paradigm shifts take time
• Start slowly and learn as you go
MIGRATION STRATEGIES
1. Greenfield project
• Applicable for:
– New projects
– Self-contained
– Experimental/non-critical
• Assume 3-4 weeks’
overhead
2. Gateway drug
• Scala rocks your tests!
– Expressive syntax
– DSL support
– Excellent libraries
• Trivial integration
– Ant/Maven/Gradle…
– Non-production code!
class StackTest extends Specification {
"Seq.head" should {
"throw an exception if empty" in {
Seq.empty[Any].head should
throwA[NoSuchElementException]
}
"return the first element" in {
Seq(1, 2, 3).head shouldEqual 1
}
}
}
3. The layered approach
Components
Frameworks
Deployment Executable Container
Crawler framework
Twitter TripAdvisor OpenTable
Web framework
Dashboard Backoffice
4. The silo approach
Components
Frameworks
Deployment Executable Container
Crawler framework
Twitter TripAdvisor OpenTable
Web framework
Dashboard Backoffice
Learnin
g
Books
Online Resources
Online training The usual suspects
… and more
PRACTICAL
CONSIDERATIONS
On Build Times
• Compiling Scala
is slow…
• Incremental
compilation helps. A
lot 00:00.0
00:17.3
00:34.6
00:51.8
01:09.1
01:26.4
01:43.7
02:01.0
02:18.2
02:35.5
02:52.8
Build #
Time
Initial Build
Refactoring
On Build Times
Developmen
t
• Use IDEA
• … or Eclipse
CI
• Using Maven?
Add Zinc
• … or use Sbt
Release
• Clean builds
• Skip Zinc
Embrace Immutability
• Scala makes it easy:
– “val” keyword
– Collections
– Case classes
• Do I need to reiterate why?
– Easier to reason about!
Functional Madness
• Scala supports functional programming
• That doesn’t mean you do…
– Recursion is hard
– Category theory is hard
– Being side-effect free is hard
• Stick to what you know… for now.
Collective Abuse
• Scala has a massive
collection library
• Loads of built-ins too
– Case classes
– Functions and partials
– Tuples, tuples, tuples
• Fairly easy to abuse
Collective Abuse
• Anti-pattern: Too many inline steps
val actors: List[(Int, String, Double)] = // ...
def bestActor(query: String) =
actors.filter(_._2 contains query)
.sortBy(-_._3)
.map(_._1)
.headOption
1. What does this even do?!
2. How does data flow here?
Collective Abuse
• Anti-pattern: Too many inline steps
val actors: List[(Int, String, Double)] = // ...
def bestActor(query: String) = {
val matching = actors.filter(_._2 contains query)
val bestByScore = matching.sortBy(-_._3).headOption
bestByScore.map(_._1)
}
Name intermediate steps!
Collective Abuse
• Anti-pattern: Tuple overload
val actors: List[(Int, String, Double)] = // ...
def bestActor(query: String) =
actors.filter(_._2 contains query)
.sortBy(-_._3)
.map(_._1)
.headOption
What’s with all these
underscores?
Collective Abuse
• Anti-pattern: Tuple overload
case class Actor(id: Int, name: String, score: Double)
def bestActor(query: String, actors: List[Actor]) =
actors.filter(_.name contains query)
.sortBy(-_.score)
.map(_.id)
.headOption
Scala classes are cheap.
Use them.
Symbolic Operators
• Just because you can…
• … doesn’t mean you should
• What does that even mean?
s(7) <*> (s(8) <*> (s(9) ∘ add3))
Ecosystem
Let’s Get Busy
• The Scala ecosystem is huge
• It subsumes Java’s
• Also features unique offerings
• Let’s discuss a few…
Testing
Web Servers
Microservices
Cautionary Tale
• Beware scalaz and cats
– Both are amazing
– Both do a lot
– But they’re quite advanced
– … and poorly documented
• Remember: YAGNI
A Word on Akka
• Akka is fantastic
– High performance
– Full-featured
– Great libraries (akka-http)
• But: is the actor model for you?
• Remember: YAGNI
Call to
Action
Last but not least…
>120 User Groups
worldwide!
http://scala.space
Participate!
Participate!
WE’RE DONE HERE!
Time to push the green button :-)
tomer@tomergabel.com
@tomerg
http://il.linkedin.com/in/tomergabel

Weitere ähnliche Inhalte

Was ist angesagt?

Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and
Ryan Cuprak
 

Was ist angesagt? (20)

KYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under ControlKYSUC - Keep Your Schema Under Control
KYSUC - Keep Your Schema Under Control
 
Developing in the Cloud
Developing in the CloudDeveloping in the Cloud
Developing in the Cloud
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Maven - Taming the Beast
Maven - Taming the BeastMaven - Taming the Beast
Maven - Taming the Beast
 
Building Asynchronous Applications
Building Asynchronous ApplicationsBuilding Asynchronous Applications
Building Asynchronous Applications
 
Scala profiling
Scala profilingScala profiling
Scala profiling
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?
 
Java 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala StoryJava 8 and Beyond, a Scala Story
Java 8 and Beyond, a Scala Story
 
Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco Repository
 
JavaOne 2015: 12 Factor App
JavaOne 2015: 12 Factor AppJavaOne 2015: 12 Factor App
JavaOne 2015: 12 Factor App
 
Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016Scala Frameworks for Web Application 2016
Scala Frameworks for Web Application 2016
 
Scala in Model-Driven development for Apparel Cloud Platform
Scala in Model-Driven development for Apparel Cloud PlatformScala in Model-Driven development for Apparel Cloud Platform
Scala in Model-Driven development for Apparel Cloud Platform
 
DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11DevNexus 2019: Migrating to Java 11
DevNexus 2019: Migrating to Java 11
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
Why akka
Why akkaWhy akka
Why akka
 
Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
12-factor-jruby
12-factor-jruby12-factor-jruby
12-factor-jruby
 

Ähnlich wie Scala in the Wild

Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
Roman Elizarov
 
Parallel programming
Parallel programmingParallel programming
Parallel programming
Swain Loda
 

Ähnlich wie Scala in the Wild (20)

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
 
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
 
Java Serialization Facts and Fallacies
Java Serialization Facts and FallaciesJava Serialization Facts and Fallacies
Java Serialization Facts and Fallacies
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React App
 
pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)pull requests I sent to scala/scala (ny-scala 2019)
pull requests I sent to scala/scala (ny-scala 2019)
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
 
JS Essence
JS EssenceJS Essence
JS Essence
 
Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)Polyglot and Functional Programming (OSCON 2012)
Polyglot and Functional Programming (OSCON 2012)
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Parallel programming
Parallel programmingParallel programming
Parallel programming
 
Scala Introduction
Scala IntroductionScala Introduction
Scala Introduction
 
Java and the JVM
Java and the JVMJava and the JVM
Java and the JVM
 
Google guava overview
Google guava overviewGoogle guava overview
Google guava overview
 
33rd degree
33rd degree33rd degree
33rd degree
 
Java Closures
Java ClosuresJava Closures
Java Closures
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 
Java to Scala: Why & How
Java to Scala: Why & HowJava to Scala: Why & How
Java to Scala: Why & How
 

Mehr von Tomer Gabel

Mehr von Tomer Gabel (20)

How shit works: Time
How shit works: TimeHow shit works: Time
How shit works: Time
 
Nondeterministic Software for the Rest of Us
Nondeterministic Software for the Rest of UsNondeterministic Software for the Rest of Us
Nondeterministic Software for the Rest of Us
 
Slaying Sacred Cows: Deconstructing Dependency Injection
Slaying Sacred Cows: Deconstructing Dependency InjectionSlaying Sacred Cows: Deconstructing Dependency Injection
Slaying Sacred Cows: Deconstructing Dependency Injection
 
An Abridged Guide to Event Sourcing
An Abridged Guide to Event SourcingAn Abridged Guide to Event Sourcing
An Abridged Guide to Event Sourcing
 
How shit works: the CPU
How shit works: the CPUHow shit works: the CPU
How shit works: the CPU
 
How Shit Works: Storage
How Shit Works: StorageHow Shit Works: Storage
How Shit Works: Storage
 
Scala Refactoring for Fun and Profit (Japanese subtitles)
Scala Refactoring for Fun and Profit (Japanese subtitles)Scala Refactoring for Fun and Profit (Japanese subtitles)
Scala Refactoring for Fun and Profit (Japanese subtitles)
 
Scala Refactoring for Fun and Profit
Scala Refactoring for Fun and ProfitScala Refactoring for Fun and Profit
Scala Refactoring for Fun and Profit
 
Onboarding at Scale
Onboarding at ScaleOnboarding at Scale
Onboarding at Scale
 
Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)Speaking Scala: Refactoring for Fun and Profit (Workshop)
Speaking Scala: Refactoring for Fun and Profit (Workshop)
 
Put Your Thinking CAP On
Put Your Thinking CAP OnPut Your Thinking CAP On
Put Your Thinking CAP On
 
Leveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better ValidationLeveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better Validation
 
A Field Guide to DSL Design in Scala
A Field Guide to DSL Design in ScalaA Field Guide to DSL Design in Scala
A Field Guide to DSL Design in Scala
 
Functional Leap of Faith (Keynote at JDay Lviv 2014)
Functional Leap of Faith (Keynote at JDay Lviv 2014)Functional Leap of Faith (Keynote at JDay Lviv 2014)
Functional Leap of Faith (Keynote at JDay Lviv 2014)
 
Scala Back to Basics: Type Classes
Scala Back to Basics: Type ClassesScala Back to Basics: Type Classes
Scala Back to Basics: Type Classes
 
5 Bullets to Scala Adoption
5 Bullets to Scala Adoption5 Bullets to Scala Adoption
5 Bullets to Scala Adoption
 
Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)
 
Ponies and Unicorns With Scala
Ponies and Unicorns With ScalaPonies and Unicorns With Scala
Ponies and Unicorns With Scala
 
Lab: JVM Production Debugging 101
Lab: JVM Production Debugging 101Lab: JVM Production Debugging 101
Lab: JVM Production Debugging 101
 
DevCon³: Scala Best Practices
DevCon³: Scala Best PracticesDevCon³: Scala Best Practices
DevCon³: Scala Best Practices
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

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?
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Scala in the Wild

  • 1. Scala in the Wild Tomer Gabel, JavaOne 2015
  • 2. Agenda • Scala in a nutshell • Bootstrapping • Practical Considerations • Ecosystem • Call to action
  • 3. Who is this guy? Me • System architect at Wix • Scala user since 2011 • User group leader: – Underscore (Scala) – Java.IL (Java/JVM) • Organizer of Scalapeño
  • 4. Who is this guy? Me • System architect at Wix • Scala user since 2011 • User group leader: – Underscore (Scala) – Java.IL (Java/JVM) • Organizer of Scalapeño Wix • >70M sites • Scala shop since 2012 • The usual suspects: – Microservices – Continuous delivery – Legacy Java codebase
  • 6. Recap • You’ve heard it all before! – Statically-typed – Targets the JVM – … and JavaScript, and Android – Hybrid object-oriented/functional – Ponies, unicorns, yada yada yada
  • 7. Executive Summary A better Java • Less boilerplate • Less baggage • Less old and boring • New toys to play with • ⇒ Happier developers
  • 8. Executive Summary A better Java • Less boilerplate • Less baggage • Less old and boring • New toys to play with • ⇒ Happier developers Gateway drug to Haskell • Can be functional • ... if you want it to • Better abstractions
  • 9. Executive Summary A better Java • Less boilerplate • Less baggage • Less old and boring Gateway drug to Haskell • Can be functional • ... if you want it to • Better abstractions • New toys to play with • ⇒ Happier developers
  • 10. The Fineprint • Warts – Compilation times – Imperfect IDEs – Documentation – Debugging* • Semi-known quantity – Still pretty new – Few best practices – No style guide – New ⇒ prone to abuse
  • 12. Gimme Three Steps IntelliJ IDEA NetBeans Eclipse gradle maven ant 1. Stick with what you know
  • 13. Gimme Three Steps Hibernate Guava/Guice Spring 2. Grow a hybrid codebase • Mix Scala/Java freely! – Same codebase – Same libraries – A single runtime dependency!
  • 14. Gimme Three Steps 3. Keep it simple • You don’t have to go all in • In fact, you probably shouldn’t: – Language mastery takes time – Paradigm shifts take time • Start slowly and learn as you go
  • 16. 1. Greenfield project • Applicable for: – New projects – Self-contained – Experimental/non-critical • Assume 3-4 weeks’ overhead
  • 17. 2. Gateway drug • Scala rocks your tests! – Expressive syntax – DSL support – Excellent libraries • Trivial integration – Ant/Maven/Gradle… – Non-production code! class StackTest extends Specification { "Seq.head" should { "throw an exception if empty" in { Seq.empty[Any].head should throwA[NoSuchElementException] } "return the first element" in { Seq(1, 2, 3).head shouldEqual 1 } } }
  • 18. 3. The layered approach Components Frameworks Deployment Executable Container Crawler framework Twitter TripAdvisor OpenTable Web framework Dashboard Backoffice
  • 19. 4. The silo approach Components Frameworks Deployment Executable Container Crawler framework Twitter TripAdvisor OpenTable Web framework Dashboard Backoffice
  • 21. Books
  • 22. Online Resources Online training The usual suspects … and more
  • 24. On Build Times • Compiling Scala is slow… • Incremental compilation helps. A lot 00:00.0 00:17.3 00:34.6 00:51.8 01:09.1 01:26.4 01:43.7 02:01.0 02:18.2 02:35.5 02:52.8 Build # Time Initial Build Refactoring
  • 25. On Build Times Developmen t • Use IDEA • … or Eclipse CI • Using Maven? Add Zinc • … or use Sbt Release • Clean builds • Skip Zinc
  • 26. Embrace Immutability • Scala makes it easy: – “val” keyword – Collections – Case classes • Do I need to reiterate why? – Easier to reason about!
  • 27. Functional Madness • Scala supports functional programming • That doesn’t mean you do… – Recursion is hard – Category theory is hard – Being side-effect free is hard • Stick to what you know… for now.
  • 28. Collective Abuse • Scala has a massive collection library • Loads of built-ins too – Case classes – Functions and partials – Tuples, tuples, tuples • Fairly easy to abuse
  • 29. Collective Abuse • Anti-pattern: Too many inline steps val actors: List[(Int, String, Double)] = // ... def bestActor(query: String) = actors.filter(_._2 contains query) .sortBy(-_._3) .map(_._1) .headOption 1. What does this even do?! 2. How does data flow here?
  • 30. Collective Abuse • Anti-pattern: Too many inline steps val actors: List[(Int, String, Double)] = // ... def bestActor(query: String) = { val matching = actors.filter(_._2 contains query) val bestByScore = matching.sortBy(-_._3).headOption bestByScore.map(_._1) } Name intermediate steps!
  • 31. Collective Abuse • Anti-pattern: Tuple overload val actors: List[(Int, String, Double)] = // ... def bestActor(query: String) = actors.filter(_._2 contains query) .sortBy(-_._3) .map(_._1) .headOption What’s with all these underscores?
  • 32. Collective Abuse • Anti-pattern: Tuple overload case class Actor(id: Int, name: String, score: Double) def bestActor(query: String, actors: List[Actor]) = actors.filter(_.name contains query) .sortBy(-_.score) .map(_.id) .headOption Scala classes are cheap. Use them.
  • 33. Symbolic Operators • Just because you can… • … doesn’t mean you should • What does that even mean? s(7) <*> (s(8) <*> (s(9) ∘ add3))
  • 35. Let’s Get Busy • The Scala ecosystem is huge • It subsumes Java’s • Also features unique offerings • Let’s discuss a few…
  • 39. Cautionary Tale • Beware scalaz and cats – Both are amazing – Both do a lot – But they’re quite advanced – … and poorly documented • Remember: YAGNI
  • 40. A Word on Akka • Akka is fantastic – High performance – Full-featured – Great libraries (akka-http) • But: is the actor model for you? • Remember: YAGNI
  • 41. Call to Action Last but not least…
  • 44. WE’RE DONE HERE! Time to push the green button :-) tomer@tomergabel.com @tomerg http://il.linkedin.com/in/tomergabel

Hinweis der Redaktion

  1. Image source: https://www.flickr.com/photos/sarairachel/7876010420 (CC)
  2. Image source: https://www.flickr.com/photos/60848944@N00/3537064556
  3. Image source: http://onlinesalesstepbystep.com/wp-content/uploads/2014/08/Toppling-books.jpg