SlideShare a Scribd company logo
in PracticeScala
@patforna
patric.fornasier@springer.com
3 years later…
Context
Context
Pat
Springer
Software
Engineer
Technical
Principal
10+ years
Academic
Publisher
Pretty Large
Springer
Link
Strategic
95 % Online
Revenue
66 % Total
Revenue
9 Mio items
2TB XML
Re-built
3 years ago
Content
Delivery
Platform
52 Mio
PageViews / Month
99.9%
Availability
Scala NoSql
Co-Sourced
Team
TW
Ex-TW
Springer
Global
CD
SpringerLink
Timeline
Start
development
Cycling
Trip
Re-joined
Product -> platform
Paying back tech debt
Today
04/11 04/12 08/13 04/14
Inception
05/12 09/12
Bookfair
Release
RD
Live
User migration,
enhancements
Link
Live
Smart
Books
Live
Enhancements
Looking back: why scala?
• Increase productivity
• Be more attractive employer
• Team decision
Looking back: good vs bad
Good
• Functional programming
• Terse syntax
• JVM ecosystem
• Gentle learning curve
• DSL friendly syntax
• Motivated team
Bad
• Tool support
• Compilation times
• Language complexity #moreRope
Fast-forward
Fast-forward (Aug 2013)
• 2.5 years into project
• 1.5 years of weekly live releases
• 100k LOC
• >10k commits
• >90 committers
Fast-forward (Aug 2013)
• 2.5 years into project
• 1.5 years of weekly live releases
• 100k LOC
• >10k commits
• >90 committers
not all related to Scala - to be fair
• Poor feedback loops
• Lots of accidental complexity
Trend (2 years)
LOC
~ 100k
Trend (2 years)
build time
LOC
Trend (2 years)
build time
LOC
• 1:34 min src/main
• 6:44 min src/test
• 8:18 min total
What did we do?
What did we do
• Reduced build time
• Improved feedback loops
• Reduced accidental complexity
Build time
• Reduced size of codebase (broke off vertical slices, pulled out APIs, pulled out libraries,
removed unused features, removed low-value tests, etc.)
• Reduced usage of certain language features (esp. traits and implicits)
Trend (Dec 2013)
LOC
Trend (Dec 2013)
build time
# traits
LOC
unable to compile on	

13” macbook
Trend (Dec 2013)
build time
# traits
LOC
unable to compile on	

13” macbook
The problem with traits
• Will re-compile on every class the trait is mixed in
• Slows down dev-build cycle
• Will result in byte code bloat
• Will compile *a lot* slower
!
For faster compile times:
• Use pure traits
• Use old-school composition for code re-use
• Use pure functions via imports (e.g. import Foo._)
• If unavoidable, use inheritance for code re-use
Build time
Build time
• 1:34 min src/main
• 6:44 min src/test
• 8:18 min total
Build time
• 1:34 min src/main
• 6:44 min src/test
• 8:18 min total
• 0:24 min src/main
• 3:11 min src/test
• 3:35 min total
Build time (on CI server)
• Incremental compilation on CI
• Only one dedicated CI agent
• Physical build servers
• CPUs with higher clock speed
Build time (on CI server)
• Incremental compilation on CI
• Only one dedicated CI agent
• Physical build servers
• CPUs with higher clock speed
Complexity
Complexity
• There’s still a lot of code in our codebase that is hard to read
• It seems to be very easy to shoot yourself in the foot with Scala
• Scala *is* complex (and that’s why scalac will never be as fast as javac)
Complexity
• There’s still a lot of code in our codebase that is hard to read
• It seems to be very easy to shoot yourself in the foot with Scala
• Scala *is* complex (and that’s why scalac will never be as fast as javac)
Invariant/covariant/contravariant types (T, +T and -T)	
Refined types (new Foo {...})	
Structural types (x: {def y: Int})	
Path dependant types (a.B)	
Specialized types (@specialized)	
Self types (this =>)	
Projection types (A#B)	
Existential types (M[_])	
Type bounds (<:, >:) 	
Type constraints (=:=, <:< and <%<)	
Type members (type T)	
Type aliases (type T = Int)	
Type classes ( (implicit ...) )	
View bounds (<%)	
Higher kinded types (* => *)	
F-Bounded type polymorphism (M[T <: M[T]])
http://nurkiewicz.github.io/talks/2014/scalar/#/16
Not opinionated
For example: http://twitter.github.io/effectivescala/
• Many ways to do the same thing
• Coding conventions help, but only so much
Not opinionated
def foo() = "foo"	
def bar = "bar"	
!
foo	
foo()	
bar	
bar() // won't compile
For example: http://twitter.github.io/effectivescala/
• Many ways to do the same thing
• Coding conventions help, but only so much
Not opinionated
def foo() = "foo"	
def bar = "bar"	
!
foo	
foo()	
bar	
bar() // won't compile
For example: http://twitter.github.io/effectivescala/
• Many ways to do the same thing
• Coding conventions help, but only so much
def baz(x: String) = x	
“x”.charAt(0)	
“x” charAt(0) // won't compile	
“x”.charAt 0 // won't compile	
“x” charAt 0	
baz("x")	
baz “x" // won't compile
Not opinionated
def foo() = "foo"	
def bar = "bar"	
!
foo	
foo()	
bar	
bar() // won't compile
list.foreach { x => println(x) }	
list.foreach ( x => println(x) )	
list.foreach { println(_) }	
list.foreach ( println(_) )	
list foreach { x => println(x) }	
list foreach ( x => println(x) )	
list foreach { println(_) }	
list foreach ( println(_) )
For example: http://twitter.github.io/effectivescala/
• Many ways to do the same thing
• Coding conventions help, but only so much
def baz(x: String) = x	
“x”.charAt(0)	
“x” charAt(0) // won't compile	
“x”.charAt 0 // won't compile	
“x” charAt 0	
baz("x")	
baz “x" // won't compile
Not opinionated
def foo() = "foo"	
def bar = "bar"	
!
foo	
foo()	
bar	
bar() // won't compile
list.foreach { x => println(x) }	
list.foreach ( x => println(x) )	
list.foreach { println(_) }	
list.foreach ( println(_) )	
list foreach { x => println(x) }	
list foreach ( x => println(x) )	
list foreach { println(_) }	
list foreach ( println(_) )
if (foo) "x" else "y"	
	
foo match {	
case true => "x"	
case _ => "y"	
}
For example: http://twitter.github.io/effectivescala/
• Many ways to do the same thing
• Coding conventions help, but only so much
def baz(x: String) = x	
“x”.charAt(0)	
“x” charAt(0) // won't compile	
“x”.charAt 0 // won't compile	
“x” charAt 0	
baz("x")	
baz “x" // won't compile
Surprises
http://dan.bodar.com/2013/12/04/wat-scala/
Surprises
List(1, 2, 3).toSet
http://dan.bodar.com/2013/12/04/wat-scala/
Surprises
List(1, 2, 3).toSet
scala.collection.immutable.Set[Int] = Set(1, 2, 3)
http://dan.bodar.com/2013/12/04/wat-scala/
Surprises
List(1, 2, 3).toSet
scala.collection.immutable.Set[Int] = Set(1, 2, 3)
List(1, 2, 3).toSet()
http://dan.bodar.com/2013/12/04/wat-scala/
Surprises
List(1, 2, 3).toSet
scala.collection.immutable.Set[Int] = Set(1, 2, 3)
List(1, 2, 3).toSet()
Boolean = false
http://dan.bodar.com/2013/12/04/wat-scala/
Implicits
• Can make it very hard to read code
• Tool support is very bad
• Impacts compilation time
• Surprising behaviour (esp. when used with overloaded methods or optional params)
Tooling
def handle(response: HttpResponse, request: HttpRequest)
• Tool support is still very basic
• Makes it hard to continuously refactor (which means people are less likely to do it)
Tooling
def handle(response: HttpResponse, request: HttpRequest)
• Tool support is still very basic
• Makes it hard to continuously refactor (which means people are less likely to do it)
no luck with “change signature”
refactoring support
Trait entanglements
• Makes it difficult to reason about behaviour
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
trait B extends A {
override def foo = "b"
}
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
trait B extends A {
override def foo = "b"
}
class C extends A with B
new C().foo
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
trait B extends A {
override def foo = "b"
}
class C extends A with B
new C().foo
"b"
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
trait B extends A {
override def foo = "b"
}
class C extends A with B
new C().foo
"b"
class D extends B with A
new D().foo
Trait entanglements
• Makes it difficult to reason about behaviour
trait A {
def foo = "a"
}
trait B extends A {
override def foo = "b"
}
class C extends A with B
new C().foo
"b"
class D extends B with A
new D().foo
"b"
Trait entanglements (2)
ArticlePageSteps
WebDriverSupport
AuthorStepsCoverImageSteps
SummarySection
Waiter SectionPageSteps
CommonPageSteps
WebElementSupport
Assertions
Uris TripleEquals
OnHost TripleEqualsSupport
MachineNames
Trait entanglements (3)
ArticlePageSteps_0
WebDriverSupport_1 AuthorSteps_1 CoverImageSteps_1 SummarySection_1Waiter_1 SectionPageSteps_1 CommonPageSteps_1
CommonPageSteps_2 WebElementSupport_2Assertions_2 WebDriverSupport_2Uris_2
WebElementSupport_3 WebDriverSupport_3Uris_3 TripleEquals_3 OnHost_3
OnHost_4 TripleEqualsSupport_4 MachineNames_4
MachineNames_5
Trait entanglements (3)
ArticlePageSteps_0
WebDriverSupport_1 AuthorSteps_1 CoverImageSteps_1 SummarySection_1Waiter_1 SectionPageSteps_1 CommonPageSteps_1
CommonPageSteps_2 WebElementSupport_2Assertions_2 WebDriverSupport_2Uris_2
WebElementSupport_3 WebDriverSupport_3Uris_3 TripleEquals_3 OnHost_3
OnHost_4 TripleEqualsSupport_4 MachineNames_4
MachineNames_5
Trait entanglements (4)
ArticlePageTests_0
ArticlePageSteps_1 AboutSectionSteps_1 SearchResultsPageSteps_1 Uris_1 ArticleTestFixture_1 JavascriptSupport_1 IssuePageSteps_1 CommonAbstractSteps_1 GoogleAnalyticsSteps_1 FakeEntitlementSteps_1 ExportCitationPageSteps_1 FullTextPageSteps_1 OtherActionsSectionSteps_1
WebDriverSupport_2 AuthorSteps_2 CoverImageSteps_2 SummarySection_2Waiter_2 SectionPageSteps_2 CommonPageSteps_2
CommonPageSteps_3 WebElementSupport_3Assertions_3 WebDriverSupport_3Uris_3
WebElementSupport_4 WebDriverSupport_4Uris_4 TripleEquals_4 OnHost_4
OnHost_5 TripleEqualsSupport_5 MachineNames_5
MachineNames_6
Trait entanglements (4)
ArticlePageTests_0
ArticlePageSteps_1 AboutSectionSteps_1 SearchResultsPageSteps_1 Uris_1 ArticleTestFixture_1 JavascriptSupport_1 IssuePageSteps_1 CommonAbstractSteps_1 GoogleAnalyticsSteps_1 FakeEntitlementSteps_1 ExportCitationPageSteps_1 FullTextPageSteps_1 OtherActionsSectionSteps_1
WebDriverSupport_2 AuthorSteps_2 CoverImageSteps_2 SummarySection_2Waiter_2 SectionPageSteps_2 CommonPageSteps_2
CommonPageSteps_3 WebElementSupport_3Assertions_3 WebDriverSupport_3Uris_3
WebElementSupport_4 WebDriverSupport_4Uris_4 TripleEquals_4 OnHost_4
OnHost_5 TripleEqualsSupport_5 MachineNames_5
MachineNames_6
Imagine many more circle here
So, what’s next?
Today
• We’ve delivered successfully using Scala
• Don’t think we’re more productive (pure gut feeling, though)
• We try to stick to the good parts (conventions, functional programming, pattern matching, etc.)
• Complexity, slow compilation and lack of tool support are real problems
The future
• No urgency to move away from Scala or re-write existing systems
• Java 8 is an alternative
• Smaller teams and apps will probably lead to more polyglotism (and less Scala)
Thanks
@patforna
patric.fornasier@springer.com
http://joinit.springer.com

More Related Content

What's hot

Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
Michael Galpin
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
fanf42
 
Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
Venkateswaran Kandasamy
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
Tim Underwood
 
Practically Functional
Practically FunctionalPractically Functional
Practically Functional
djspiewak
 
Introduction to Scala : Clueda
Introduction to Scala : CluedaIntroduction to Scala : Clueda
Introduction to Scala : Clueda
Andreas Neumann
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Taro L. Saito
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
scalaconfjp
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
Sarah Mount
 
Kotlin
KotlinKotlin
Kotlin
Rory Preddy
 
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)
Tomer Gabel
 
Scala introduction
Scala introductionScala introduction
Scala introduction
Yardena Meymann
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin PresentationAndrzej Sitek
 
Introduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformIntroduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platform
EastBanc Tachnologies
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Saleem Ansari
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
Mario Camou Riveroll
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Ruslan Shevchenko
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
Marcin Gryszko
 
Scala introduction
Scala introductionScala introduction
Scala introduction
vito jeng
 

What's hot (20)

[Start] Scala
[Start] Scala[Start] Scala
[Start] Scala
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
 
Practically Functional
Practically FunctionalPractically Functional
Practically Functional
 
Introduction to Scala : Clueda
Introduction to Scala : CluedaIntroduction to Scala : Clueda
Introduction to Scala : Clueda
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
 
Kotlin
KotlinKotlin
Kotlin
 
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)
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin Presentation
 
Introduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platformIntroduction to Kotlin Language and its application to Android platform
Introduction to Kotlin Language and its application to Android platform
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 

Similar to Scala in practice - 3 years later

TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
Heejong Ahn
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launchedMat Schaffer
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails BootcampMat Schaffer
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
Barry Jones
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2
Henry S
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
Axway Appcelerator
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)mircodotta
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
Neo4j
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
 
Strong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisationStrong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisation
Damien Seguy
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
Joe Kutner
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
Shimi Bandiel
 
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experienceJAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
jazoon13
 
Elegant concurrency
Elegant concurrencyElegant concurrency
Elegant concurrency
Mosky Liu
 
Introduction to the rust programming language
Introduction to the rust programming languageIntroduction to the rust programming language
Introduction to the rust programming language
Nikolay Denev
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
Abbas Raza
 
What the C?
What the C?What the C?
What the C?
baccigalupi
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011tobiascrawley
 
Presto summit israel 2019-04
Presto summit   israel 2019-04Presto summit   israel 2019-04
Presto summit israel 2019-04
Ori Reshef
 
Building DSLs with Scala
Building DSLs with ScalaBuilding DSLs with Scala
Building DSLs with Scala
Mohit Jaggi
 

Similar to Scala in practice - 3 years later (20)

TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
 
PTW Rails Bootcamp
PTW Rails BootcampPTW Rails Bootcamp
PTW Rails Bootcamp
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2Code for Startup MVP (Ruby on Rails) Session 2
Code for Startup MVP (Ruby on Rails) Session 2
 
Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Strong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisationStrong typing : adoption, adaptation and organisation
Strong typing : adoption, adaptation and organisation
 
4 JVM Web Frameworks
4 JVM Web Frameworks4 JVM Web Frameworks
4 JVM Web Frameworks
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
 
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experienceJAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
JAZOON'13 - Paul Brauner - A backend developer meets the web: my Dart experience
 
Elegant concurrency
Elegant concurrencyElegant concurrency
Elegant concurrency
 
Introduction to the rust programming language
Introduction to the rust programming languageIntroduction to the rust programming language
Introduction to the rust programming language
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
What the C?
What the C?What the C?
What the C?
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
Presto summit israel 2019-04
Presto summit   israel 2019-04Presto summit   israel 2019-04
Presto summit israel 2019-04
 
Building DSLs with Scala
Building DSLs with ScalaBuilding DSLs with Scala
Building DSLs with Scala
 

Recently uploaded

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 

Recently uploaded (20)

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 

Scala in practice - 3 years later

  • 3. Context Pat Springer Software Engineer Technical Principal 10+ years Academic Publisher Pretty Large Springer Link Strategic 95 % Online Revenue 66 % Total Revenue 9 Mio items 2TB XML Re-built 3 years ago Content Delivery Platform 52 Mio PageViews / Month 99.9% Availability Scala NoSql Co-Sourced Team TW Ex-TW Springer Global CD
  • 5. Timeline Start development Cycling Trip Re-joined Product -> platform Paying back tech debt Today 04/11 04/12 08/13 04/14 Inception 05/12 09/12 Bookfair Release RD Live User migration, enhancements Link Live Smart Books Live Enhancements
  • 6. Looking back: why scala? • Increase productivity • Be more attractive employer • Team decision
  • 7. Looking back: good vs bad Good • Functional programming • Terse syntax • JVM ecosystem • Gentle learning curve • DSL friendly syntax • Motivated team Bad • Tool support • Compilation times • Language complexity #moreRope
  • 9. Fast-forward (Aug 2013) • 2.5 years into project • 1.5 years of weekly live releases • 100k LOC • >10k commits • >90 committers
  • 10. Fast-forward (Aug 2013) • 2.5 years into project • 1.5 years of weekly live releases • 100k LOC • >10k commits • >90 committers not all related to Scala - to be fair • Poor feedback loops • Lots of accidental complexity
  • 13. Trend (2 years) build time LOC • 1:34 min src/main • 6:44 min src/test • 8:18 min total
  • 14. What did we do?
  • 15. What did we do • Reduced build time • Improved feedback loops • Reduced accidental complexity
  • 16. Build time • Reduced size of codebase (broke off vertical slices, pulled out APIs, pulled out libraries, removed unused features, removed low-value tests, etc.) • Reduced usage of certain language features (esp. traits and implicits)
  • 18. Trend (Dec 2013) build time # traits LOC unable to compile on 13” macbook
  • 19. Trend (Dec 2013) build time # traits LOC unable to compile on 13” macbook
  • 20. The problem with traits • Will re-compile on every class the trait is mixed in • Slows down dev-build cycle • Will result in byte code bloat • Will compile *a lot* slower ! For faster compile times: • Use pure traits • Use old-school composition for code re-use • Use pure functions via imports (e.g. import Foo._) • If unavoidable, use inheritance for code re-use
  • 22. Build time • 1:34 min src/main • 6:44 min src/test • 8:18 min total
  • 23. Build time • 1:34 min src/main • 6:44 min src/test • 8:18 min total • 0:24 min src/main • 3:11 min src/test • 3:35 min total
  • 24. Build time (on CI server) • Incremental compilation on CI • Only one dedicated CI agent • Physical build servers • CPUs with higher clock speed
  • 25. Build time (on CI server) • Incremental compilation on CI • Only one dedicated CI agent • Physical build servers • CPUs with higher clock speed
  • 27. Complexity • There’s still a lot of code in our codebase that is hard to read • It seems to be very easy to shoot yourself in the foot with Scala • Scala *is* complex (and that’s why scalac will never be as fast as javac)
  • 28. Complexity • There’s still a lot of code in our codebase that is hard to read • It seems to be very easy to shoot yourself in the foot with Scala • Scala *is* complex (and that’s why scalac will never be as fast as javac) Invariant/covariant/contravariant types (T, +T and -T) Refined types (new Foo {...}) Structural types (x: {def y: Int}) Path dependant types (a.B) Specialized types (@specialized) Self types (this =>) Projection types (A#B) Existential types (M[_]) Type bounds (<:, >:) Type constraints (=:=, <:< and <%<) Type members (type T) Type aliases (type T = Int) Type classes ( (implicit ...) ) View bounds (<%) Higher kinded types (* => *) F-Bounded type polymorphism (M[T <: M[T]]) http://nurkiewicz.github.io/talks/2014/scalar/#/16
  • 29. Not opinionated For example: http://twitter.github.io/effectivescala/ • Many ways to do the same thing • Coding conventions help, but only so much
  • 30. Not opinionated def foo() = "foo" def bar = "bar" ! foo foo() bar bar() // won't compile For example: http://twitter.github.io/effectivescala/ • Many ways to do the same thing • Coding conventions help, but only so much
  • 31. Not opinionated def foo() = "foo" def bar = "bar" ! foo foo() bar bar() // won't compile For example: http://twitter.github.io/effectivescala/ • Many ways to do the same thing • Coding conventions help, but only so much def baz(x: String) = x “x”.charAt(0) “x” charAt(0) // won't compile “x”.charAt 0 // won't compile “x” charAt 0 baz("x") baz “x" // won't compile
  • 32. Not opinionated def foo() = "foo" def bar = "bar" ! foo foo() bar bar() // won't compile list.foreach { x => println(x) } list.foreach ( x => println(x) ) list.foreach { println(_) } list.foreach ( println(_) ) list foreach { x => println(x) } list foreach ( x => println(x) ) list foreach { println(_) } list foreach ( println(_) ) For example: http://twitter.github.io/effectivescala/ • Many ways to do the same thing • Coding conventions help, but only so much def baz(x: String) = x “x”.charAt(0) “x” charAt(0) // won't compile “x”.charAt 0 // won't compile “x” charAt 0 baz("x") baz “x" // won't compile
  • 33. Not opinionated def foo() = "foo" def bar = "bar" ! foo foo() bar bar() // won't compile list.foreach { x => println(x) } list.foreach ( x => println(x) ) list.foreach { println(_) } list.foreach ( println(_) ) list foreach { x => println(x) } list foreach ( x => println(x) ) list foreach { println(_) } list foreach ( println(_) ) if (foo) "x" else "y" foo match { case true => "x" case _ => "y" } For example: http://twitter.github.io/effectivescala/ • Many ways to do the same thing • Coding conventions help, but only so much def baz(x: String) = x “x”.charAt(0) “x” charAt(0) // won't compile “x”.charAt 0 // won't compile “x” charAt 0 baz("x") baz “x" // won't compile
  • 36. Surprises List(1, 2, 3).toSet scala.collection.immutable.Set[Int] = Set(1, 2, 3) http://dan.bodar.com/2013/12/04/wat-scala/
  • 37. Surprises List(1, 2, 3).toSet scala.collection.immutable.Set[Int] = Set(1, 2, 3) List(1, 2, 3).toSet() http://dan.bodar.com/2013/12/04/wat-scala/
  • 38. Surprises List(1, 2, 3).toSet scala.collection.immutable.Set[Int] = Set(1, 2, 3) List(1, 2, 3).toSet() Boolean = false http://dan.bodar.com/2013/12/04/wat-scala/
  • 39. Implicits • Can make it very hard to read code • Tool support is very bad • Impacts compilation time • Surprising behaviour (esp. when used with overloaded methods or optional params)
  • 40. Tooling def handle(response: HttpResponse, request: HttpRequest) • Tool support is still very basic • Makes it hard to continuously refactor (which means people are less likely to do it)
  • 41. Tooling def handle(response: HttpResponse, request: HttpRequest) • Tool support is still very basic • Makes it hard to continuously refactor (which means people are less likely to do it) no luck with “change signature” refactoring support
  • 42. Trait entanglements • Makes it difficult to reason about behaviour
  • 43. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" }
  • 44. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" } trait B extends A { override def foo = "b" }
  • 45. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" } trait B extends A { override def foo = "b" } class C extends A with B new C().foo
  • 46. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" } trait B extends A { override def foo = "b" } class C extends A with B new C().foo "b"
  • 47. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" } trait B extends A { override def foo = "b" } class C extends A with B new C().foo "b" class D extends B with A new D().foo
  • 48. Trait entanglements • Makes it difficult to reason about behaviour trait A { def foo = "a" } trait B extends A { override def foo = "b" } class C extends A with B new C().foo "b" class D extends B with A new D().foo "b"
  • 49. Trait entanglements (2) ArticlePageSteps WebDriverSupport AuthorStepsCoverImageSteps SummarySection Waiter SectionPageSteps CommonPageSteps WebElementSupport Assertions Uris TripleEquals OnHost TripleEqualsSupport MachineNames
  • 50. Trait entanglements (3) ArticlePageSteps_0 WebDriverSupport_1 AuthorSteps_1 CoverImageSteps_1 SummarySection_1Waiter_1 SectionPageSteps_1 CommonPageSteps_1 CommonPageSteps_2 WebElementSupport_2Assertions_2 WebDriverSupport_2Uris_2 WebElementSupport_3 WebDriverSupport_3Uris_3 TripleEquals_3 OnHost_3 OnHost_4 TripleEqualsSupport_4 MachineNames_4 MachineNames_5
  • 51. Trait entanglements (3) ArticlePageSteps_0 WebDriverSupport_1 AuthorSteps_1 CoverImageSteps_1 SummarySection_1Waiter_1 SectionPageSteps_1 CommonPageSteps_1 CommonPageSteps_2 WebElementSupport_2Assertions_2 WebDriverSupport_2Uris_2 WebElementSupport_3 WebDriverSupport_3Uris_3 TripleEquals_3 OnHost_3 OnHost_4 TripleEqualsSupport_4 MachineNames_4 MachineNames_5
  • 52. Trait entanglements (4) ArticlePageTests_0 ArticlePageSteps_1 AboutSectionSteps_1 SearchResultsPageSteps_1 Uris_1 ArticleTestFixture_1 JavascriptSupport_1 IssuePageSteps_1 CommonAbstractSteps_1 GoogleAnalyticsSteps_1 FakeEntitlementSteps_1 ExportCitationPageSteps_1 FullTextPageSteps_1 OtherActionsSectionSteps_1 WebDriverSupport_2 AuthorSteps_2 CoverImageSteps_2 SummarySection_2Waiter_2 SectionPageSteps_2 CommonPageSteps_2 CommonPageSteps_3 WebElementSupport_3Assertions_3 WebDriverSupport_3Uris_3 WebElementSupport_4 WebDriverSupport_4Uris_4 TripleEquals_4 OnHost_4 OnHost_5 TripleEqualsSupport_5 MachineNames_5 MachineNames_6
  • 53. Trait entanglements (4) ArticlePageTests_0 ArticlePageSteps_1 AboutSectionSteps_1 SearchResultsPageSteps_1 Uris_1 ArticleTestFixture_1 JavascriptSupport_1 IssuePageSteps_1 CommonAbstractSteps_1 GoogleAnalyticsSteps_1 FakeEntitlementSteps_1 ExportCitationPageSteps_1 FullTextPageSteps_1 OtherActionsSectionSteps_1 WebDriverSupport_2 AuthorSteps_2 CoverImageSteps_2 SummarySection_2Waiter_2 SectionPageSteps_2 CommonPageSteps_2 CommonPageSteps_3 WebElementSupport_3Assertions_3 WebDriverSupport_3Uris_3 WebElementSupport_4 WebDriverSupport_4Uris_4 TripleEquals_4 OnHost_4 OnHost_5 TripleEqualsSupport_5 MachineNames_5 MachineNames_6 Imagine many more circle here
  • 55. Today • We’ve delivered successfully using Scala • Don’t think we’re more productive (pure gut feeling, though) • We try to stick to the good parts (conventions, functional programming, pattern matching, etc.) • Complexity, slow compilation and lack of tool support are real problems
  • 56. The future • No urgency to move away from Scala or re-write existing systems • Java 8 is an alternative • Smaller teams and apps will probably lead to more polyglotism (and less Scala)