SlideShare a Scribd company logo
1 of 43
Power Up Your Build
OMER VAN KLOETEN
This talk
 We can all do better
 Good, not best, practices
 No one-size-fits-all
 Not just green-field
 Open discussion
Who?
 Omer van Kloeten
 16 years in the industry
 Scala and sbt since 2012
 @omervk everywhere
A Good Build
 Explicit Compiler Behavior
 Robust and Repeatable
 Fast(-ish)
 Promotes Idiomatic Scala
 At the Right Level
Build Tools
 sbt
 cbt
 Mill
 Bazel
 Maven
 Gradle
 Pants
The Compiler
“
”
THE COMPILER IS YOUR FRIEND
AND FRIENDS TELL FRIENDS
WHEN THEY TRY TO DO STUPID THINGS
Hila Noga, “From Prehistoric to a New Age”, Scalapeño 2016
https://www.youtube.com/watch?v=N9loHZAI1NM
Build Passes! 🎉
Youhavediedofcompilerwarnings.
Out of sight, out of mind
“
”
-Xfatal-warnings
IS LIKE GLOBAL WARMING
YOU WANT TO DO SOMETHING ABOUT IT
BUT YOU NEVER DO
AND NOW IT'S TOO LATE
Andrew Phillips, “Essential vs Accidental Complexity in Scala & Dotty” (paraphrased),
ScalaWorld 2016
https://www.youtube.com/watch?v=Ay-9aanosUM
scalac Flags
 -deprecation
 -unchecked
 case _: Option[Int] =>
 -feature
 What level of Scala are you on?
 -language:implicitConversions (use splain)
scalac Flags
 Advanced Settings: -X
 -Xcheckinit ※
 -Xfuture
 -Xlint
 Run scalac –X for a list
class Foo {
val bar = baz // not yet
val baz = 1
}
scalac Flags
def print(x: (Int, Int)) =
println("Tupled")
def print(t: Int, x: Int) =
println("Untupled")
print(1, 2)
scalac Flags
def print(x: (Int, Int)) =
println("Tupled")
print(1, 2)
scalac Flags
 “Private” Settings: -Y
 -Yno-adapted-args
 -Ywarn-*
 Run scalac –Y for a list
YMMV
 Do what’s right for you
 “Recommended Scalac Flags for 2.12” by Rob Norris (@tpolecat)
https://tpolecat.github.io/2017/04/25/scalac-flags.html
Promoting Better Code
Linters
 FindBugs
 Linter
 Abide
 Scalastyle
 scapegoat
Linters
(that you should care about)
 -Xlint:*
 WartRemover
 Scalafix
 IntelliJ IDEA
 Leif Wickland, “Toward A Safer Scala”, ScalaDays SF 2015
https://www.youtube.com/watch?v=CQY5ef6R_eg
WartRemover
 All rules are opt-in
 No “Better Java”
 AsInstanceOf / IsInstanceOf
 Null
 Return
WartRemover
 Good Practices
 ExplicitImplicitTypes
 PublicInference
implicit def foo(): Bar = new Bar()
def foo(): Bar = new Bar()
WartRemover
 Language Best Practices
 FinalCaseClass
 LeakingSealed
final case class Foo()
sealed trait A
sealed trait B extends A
final class C extends A
WartRemover
 Standard Library Best Practices
 ArrayEquals
 JavaConversions
Array(1.toByte) == Array(1.toByte)
javaList.asScala
WartRemover
 Avoid Throwing
 OptionPartial
 TraversableOps
 TryPartial
none.get
emptyList.head
emptyList.reduce(_ + _)
failedTry.get
wartremover-contrib
 ExposedTuples
 OldTime
 SomeApply
def foo(): (Int, String)
new java.util.Date()
val foo = Some(null)
“
”
ANY STYLE GUIDE WRITTEN IN ENGLISH
IS EITHER SO BRIEF THAT IT’S AMBIGUOUS,
OR SO LONG THAT NO ONE READS IT
Bob Nystrom, "Hardest Program I've Ever Written”
http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/
Styleguides
 Infinite
 Unwritten Rules
 “Feels Right”
 Unenforceable
Automated Code Formatting
 Auto-reformat code on compile
 Be hated by peers
 scalafmt
 sbt-scalafmt
 IntelliJ IDEA
Versioning
Versions
 Metadata
 Easy Consensus
 Semantic Versioning
 Breaking.BackCompat.Patch
 Marketing.New.BugFix
 Copy of Copy of Software Final (3).docx
Types of Versions
 Canonical versions
 1.2.3
 Non-canonical versions
 Between 1.2.3 and 1.2.4
 Date? Branch? Hash?
 Not even a version
 Snapshots
Versioning
 git describe --tags
 2.15.1-29-g866b31dfe-SNAPSHOT
 Use sbt-git
enablePlugins(GitVersioning)
git.useGitDescribe := true
Dependencies
sbt-coursier
 Pure Scala Ivy Replacement
 Parallel Downloads (Fast!)
 No Global Lock
 Coming natively to sbt
sbt/librarymanagement/pull/190
Zero Pending Updates Policy
 First commit after release
 Can’t upgrade?
 Triage
 Open issues
 Fix bugs
 Schedule upgrade
Ivy
 Dynamic Revisions
 1.11.+
 [1.0,2.0)
JitPack
 GitHub’s Auto-Repository
 DEPEND ON ANYTHING
 Release
 Tag
 Branch
 Commit
 On-demand
 Free!
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.User" % "Repo" % "Tag”
sbt-updates
 Makes Life Easy
 Explained Upgrade Path
> dependencyUpdates
[info] Found 3 dependency updates for test-project
[info] ch.qos.logback:logback-classic : 0.8.1 -> 0.9.30 -> 1.2.3
[info] org.scala-lang:scala-library : 2.11.5 -> 2.11.12 -> 2.12.5
[info] org.slf4j:slf4j-api : 1.7.21 -> 1.7.25
sbt-dependency-check
 Security Issues Check
 Uses the Open Web Application Security Project (OWASP)
sbt-dependency-graph
 What’s Using What
 It’s always Jackson or Guava
> dependencyGraph
[info] com.omervk:mylib_2.12:0.0.1-ga480c6e-SNAPSHOT [S]
[info] +-com.amazonaws:aws-java-sdk-s3:1.11.160
[info] | +-com.amazonaws:aws-java-sdk-core:1.11.160
[info] | | +-com.fasterxml.jackson.core:jackson-databind:2.6.6
[info] | | | +-com.fasterxml.jackson.core:jackson-annotations:2.6.0
[info] | | | +-com.fasterxml.jackson.core:jackson-core:2.6.6
[info] | | |
[info] | | +-com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.6.6
[info] | | | +-com.fasterxml.jackson.core:jackson-core:2.6.6
[info] | | |
[info] | | +-joda-time:joda-time:2.8.1
[info] | | +-org.apache.httpcomponents:httpclient:4.5.2
[info] | | | +-commons-codec:commons-codec:1.9
[info] | | | +-org.apache.httpcomponents:httpcore:4.4.4
[info] | | |
[info] | | +-software.amazon.ion:ion-java:1.0.2
[info] | |
Honorable Mentions
 sbt-assembly
 sbt-native-packager
This slide intentionally left blank

More Related Content

What's hot

What's hot (20)

Perl Development Environment Tooling
Perl Development Environment ToolingPerl Development Environment Tooling
Perl Development Environment Tooling
 
Мониторинг облачной CI-системы на примере Jenkins / Александр Акбашев (HERE T...
Мониторинг облачной CI-системы на примере Jenkins / Александр Акбашев (HERE T...Мониторинг облачной CI-системы на примере Jenkins / Александр Акбашев (HERE T...
Мониторинг облачной CI-системы на примере Jenkins / Александр Акбашев (HERE T...
 
TDC 2016 Floripa - Testando APIs REST com Supertest e Promises
TDC 2016 Floripa - Testando APIs REST com Supertest e PromisesTDC 2016 Floripa - Testando APIs REST com Supertest e Promises
TDC 2016 Floripa - Testando APIs REST com Supertest e Promises
 
Deployment and Continous Integration of a Zope/Plone application
Deployment and Continous Integration of a Zope/Plone applicationDeployment and Continous Integration of a Zope/Plone application
Deployment and Continous Integration of a Zope/Plone application
 
Vapor london March 2018
Vapor london March 2018Vapor london March 2018
Vapor london March 2018
 
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-s...
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-s...TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-s...
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-s...
 
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
Monitoring Big Data Systems Done "The Simple Way" - Codemotion Milan 2017 - D...
 
Postgresql 9.0 HA at RMLL 2012
Postgresql 9.0 HA at RMLL 2012Postgresql 9.0 HA at RMLL 2012
Postgresql 9.0 HA at RMLL 2012
 
手機自動化測試和持續整合
手機自動化測試和持續整合手機自動化測試和持續整合
手機自動化測試和持續整合
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
 
Golang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with GlideGolang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with Glide
 
Living with Files More Happily
Living with Files More HappilyLiving with Files More Happily
Living with Files More Happily
 
Probando con grails
Probando con grailsProbando con grails
Probando con grails
 
Alexa Skills Kit programing for dummies
Alexa Skills Kit programing for dummiesAlexa Skills Kit programing for dummies
Alexa Skills Kit programing for dummies
 
Heroku for team collaboration
Heroku for team collaborationHeroku for team collaboration
Heroku for team collaboration
 
PUG Romagna - Pipeline + Deployer PHP
PUG Romagna - Pipeline + Deployer PHPPUG Romagna - Pipeline + Deployer PHP
PUG Romagna - Pipeline + Deployer PHP
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginning
 
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
COSCUP 2016: Project 52 每週一個小專案來學習 GolangCOSCUP 2016: Project 52 每週一個小專案來學習 Golang
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 

Similar to Power Up Your Build - Omer van Kloeten @ Wix 2018-04

Similar to Power Up Your Build - Omer van Kloeten @ Wix 2018-04 (20)

Power Up Your Build at Underscore 2018-02
Power Up Your Build at Underscore 2018-02Power Up Your Build at Underscore 2018-02
Power Up Your Build at Underscore 2018-02
 
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor BuzatovićJavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
JavaCro'14 - Is there Kotlin after Java 8 – Ivan Turčinović and Igor Buzatović
 
Run your Java code on Cloud Foundry
Run your Java code on Cloud FoundryRun your Java code on Cloud Foundry
Run your Java code on Cloud Foundry
 
SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
 
The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...The End of the world as we know it - AKA your last NullPointerException $1B b...
The End of the world as we know it - AKA your last NullPointerException $1B b...
 
Play framework
Play frameworkPlay framework
Play framework
 
Versions
VersionsVersions
Versions
 
Reuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless WorldReuse, Reduce, Recycle in Serverless World
Reuse, Reduce, Recycle in Serverless World
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Why scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with thisWhy scala is not my ideal language and what I can do with this
Why scala is not my ideal language and what I can do with this
 
Ruby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developerRuby on Rails survival guide of an aged Java developer
Ruby on Rails survival guide of an aged Java developer
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
WTF is Twisted?
WTF is Twisted?WTF is Twisted?
WTF is Twisted?
 
The State of Wicket
The State of WicketThe State of Wicket
The State of Wicket
 
From Android NDK To AOSP
From Android NDK To AOSPFrom Android NDK To AOSP
From Android NDK To AOSP
 
cadec-2017-golang
cadec-2017-golangcadec-2017-golang
cadec-2017-golang
 
Continuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CIContinuous Integration/Deployment with Gitlab CI
Continuous Integration/Deployment with Gitlab CI
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
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
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Recently uploaded (20)

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...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%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
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Power Up Your Build - Omer van Kloeten @ Wix 2018-04

  • 1. Power Up Your Build OMER VAN KLOETEN
  • 2. This talk  We can all do better  Good, not best, practices  No one-size-fits-all  Not just green-field  Open discussion
  • 3. Who?  Omer van Kloeten  16 years in the industry  Scala and sbt since 2012  @omervk everywhere
  • 4. A Good Build  Explicit Compiler Behavior  Robust and Repeatable  Fast(-ish)  Promotes Idiomatic Scala  At the Right Level
  • 5. Build Tools  sbt  cbt  Mill  Bazel  Maven  Gradle  Pants
  • 7. “ ” THE COMPILER IS YOUR FRIEND AND FRIENDS TELL FRIENDS WHEN THEY TRY TO DO STUPID THINGS Hila Noga, “From Prehistoric to a New Age”, Scalapeño 2016 https://www.youtube.com/watch?v=N9loHZAI1NM
  • 10. Out of sight, out of mind
  • 11. “ ” -Xfatal-warnings IS LIKE GLOBAL WARMING YOU WANT TO DO SOMETHING ABOUT IT BUT YOU NEVER DO AND NOW IT'S TOO LATE Andrew Phillips, “Essential vs Accidental Complexity in Scala & Dotty” (paraphrased), ScalaWorld 2016 https://www.youtube.com/watch?v=Ay-9aanosUM
  • 12. scalac Flags  -deprecation  -unchecked  case _: Option[Int] =>  -feature  What level of Scala are you on?  -language:implicitConversions (use splain)
  • 13. scalac Flags  Advanced Settings: -X  -Xcheckinit ※  -Xfuture  -Xlint  Run scalac –X for a list class Foo { val bar = baz // not yet val baz = 1 }
  • 14. scalac Flags def print(x: (Int, Int)) = println("Tupled") def print(t: Int, x: Int) = println("Untupled") print(1, 2)
  • 15. scalac Flags def print(x: (Int, Int)) = println("Tupled") print(1, 2)
  • 16. scalac Flags  “Private” Settings: -Y  -Yno-adapted-args  -Ywarn-*  Run scalac –Y for a list
  • 17. YMMV  Do what’s right for you  “Recommended Scalac Flags for 2.12” by Rob Norris (@tpolecat) https://tpolecat.github.io/2017/04/25/scalac-flags.html
  • 19. Linters  FindBugs  Linter  Abide  Scalastyle  scapegoat
  • 20. Linters (that you should care about)  -Xlint:*  WartRemover  Scalafix  IntelliJ IDEA  Leif Wickland, “Toward A Safer Scala”, ScalaDays SF 2015 https://www.youtube.com/watch?v=CQY5ef6R_eg
  • 21. WartRemover  All rules are opt-in  No “Better Java”  AsInstanceOf / IsInstanceOf  Null  Return
  • 22. WartRemover  Good Practices  ExplicitImplicitTypes  PublicInference implicit def foo(): Bar = new Bar() def foo(): Bar = new Bar()
  • 23. WartRemover  Language Best Practices  FinalCaseClass  LeakingSealed final case class Foo() sealed trait A sealed trait B extends A final class C extends A
  • 24. WartRemover  Standard Library Best Practices  ArrayEquals  JavaConversions Array(1.toByte) == Array(1.toByte) javaList.asScala
  • 25. WartRemover  Avoid Throwing  OptionPartial  TraversableOps  TryPartial none.get emptyList.head emptyList.reduce(_ + _) failedTry.get
  • 26. wartremover-contrib  ExposedTuples  OldTime  SomeApply def foo(): (Int, String) new java.util.Date() val foo = Some(null)
  • 27. “ ” ANY STYLE GUIDE WRITTEN IN ENGLISH IS EITHER SO BRIEF THAT IT’S AMBIGUOUS, OR SO LONG THAT NO ONE READS IT Bob Nystrom, "Hardest Program I've Ever Written” http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/
  • 28. Styleguides  Infinite  Unwritten Rules  “Feels Right”  Unenforceable
  • 29. Automated Code Formatting  Auto-reformat code on compile  Be hated by peers  scalafmt  sbt-scalafmt  IntelliJ IDEA
  • 31. Versions  Metadata  Easy Consensus  Semantic Versioning  Breaking.BackCompat.Patch  Marketing.New.BugFix  Copy of Copy of Software Final (3).docx
  • 32. Types of Versions  Canonical versions  1.2.3  Non-canonical versions  Between 1.2.3 and 1.2.4  Date? Branch? Hash?  Not even a version  Snapshots
  • 33. Versioning  git describe --tags  2.15.1-29-g866b31dfe-SNAPSHOT  Use sbt-git enablePlugins(GitVersioning) git.useGitDescribe := true
  • 35. sbt-coursier  Pure Scala Ivy Replacement  Parallel Downloads (Fast!)  No Global Lock  Coming natively to sbt sbt/librarymanagement/pull/190
  • 36. Zero Pending Updates Policy  First commit after release  Can’t upgrade?  Triage  Open issues  Fix bugs  Schedule upgrade
  • 37. Ivy  Dynamic Revisions  1.11.+  [1.0,2.0)
  • 38. JitPack  GitHub’s Auto-Repository  DEPEND ON ANYTHING  Release  Tag  Branch  Commit  On-demand  Free! resolvers += "jitpack" at "https://jitpack.io" libraryDependencies += "com.github.User" % "Repo" % "Tag”
  • 39. sbt-updates  Makes Life Easy  Explained Upgrade Path > dependencyUpdates [info] Found 3 dependency updates for test-project [info] ch.qos.logback:logback-classic : 0.8.1 -> 0.9.30 -> 1.2.3 [info] org.scala-lang:scala-library : 2.11.5 -> 2.11.12 -> 2.12.5 [info] org.slf4j:slf4j-api : 1.7.21 -> 1.7.25
  • 40. sbt-dependency-check  Security Issues Check  Uses the Open Web Application Security Project (OWASP)
  • 41. sbt-dependency-graph  What’s Using What  It’s always Jackson or Guava > dependencyGraph [info] com.omervk:mylib_2.12:0.0.1-ga480c6e-SNAPSHOT [S] [info] +-com.amazonaws:aws-java-sdk-s3:1.11.160 [info] | +-com.amazonaws:aws-java-sdk-core:1.11.160 [info] | | +-com.fasterxml.jackson.core:jackson-databind:2.6.6 [info] | | | +-com.fasterxml.jackson.core:jackson-annotations:2.6.0 [info] | | | +-com.fasterxml.jackson.core:jackson-core:2.6.6 [info] | | | [info] | | +-com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.6.6 [info] | | | +-com.fasterxml.jackson.core:jackson-core:2.6.6 [info] | | | [info] | | +-joda-time:joda-time:2.8.1 [info] | | +-org.apache.httpcomponents:httpclient:4.5.2 [info] | | | +-commons-codec:commons-codec:1.9 [info] | | | +-org.apache.httpcomponents:httpcore:4.4.4 [info] | | | [info] | | +-software.amazon.ion:ion-java:1.0.2 [info] | |

Editor's Notes

  1. It’s hard, but start now before it’s harder
  2. Scalafix promoted by Scala Center
  3. Scalafix promoted by Scala Center
  4. Not a good name to Google I’m biased :)
  5. On the right: From Apple’s leaked source code, mixes tabs and spaces