You are on page 1of 37

Scala Adoption by Enterprises

Mike Slinn
April 2, 2012

SuccessFactors, an SAP Company
About Mike Slinn
Principal at Micronautics Research
Corporation
Hands-on architect, mentor, trainer
Interim technical leader for companies in
transition
Recognized in US Federal court as a
software expert
Author of Composable Futures with Akka 2.0
Twitter: mslinn

About You, the Attendees
___% Managers
o ___% Full-time programmers
___% Interns
Programmers
o ___% New to Scala
o ___% Intermediate Scala programmers
o ___% Expert Scala programmers
o ___% Currently work on Scala projects
o ___% Windows, Linux, Mac, other
James Gosling
If I were to pick a
language to use today
other than Java, it
would be Scala
Father of Java
James Strachan
If someone had shown
me the Programming in
Scala book in 2003, I
would not have created
Groovy.
Groovy Language &
Apache Camel book
Alex Payne
Joy is underrated
as a metric for a
language's
potential success
in a development
organization
Early Twitter engineer,
co-author of
Programming Scala
What is Scala?
Natural progression on the JVM
Same deployment mechanism as Java
Scale up and out, with concurrency and/or
parallelism
o Java.util.concurrent
o Scala Parallel collections
o Actors
o Futures (allows map/reduce)
o Dataflow
o Map/reduce frameworks
Scala vs. Other OO & FP Languages
Java Scala Clojure Ruby
Typing Static Static Dynamic Dynamic
Paradigm OO OO & FP FP OO
Two Types of Programming
Imperative Programming
o Describes computation in terms of statements that
change program state
Functional Programming
o Describes computation in terms of mathematical
functions, avoiding state and mutable data
Scala is Object-Oriented
Primitives are full objects
Static methods are attached to singletons
Imperative style
You can use Scala simply as a better Java
Scala is Also Functional
Transform data objects instead of mutation
Strong list processing (e.g. map and reduce)
Thread-safe
Parallelizable
Supports composition
Stack Overflow / GitHub Popularity
Commercial Adoption
Scala jobs tripled last year
100,000 current developers?
Geoffrey Moores technology
adoption lifecyle
Gartners Hype Cycle
Scala 2012 Roadmap

Typesafe
Stack 1.0


Typesafe
Stack 1.1


Typesafe
Stack 2.0


Typesafe
Stack 2.1

May 2011 Oct 2011 Q1 2012 Q3 2012
Scala 2.9.0
Akka 1.1
Scala 2.9.1
Akka 1.2
IDE 1.0
Scala 2.9.2
Akka 2.0
Play 2.0
SBT 0.11.2
IDE 2.0 M1
Scala 2.10
Akka 2.1
Play 2.1
Slick (DB)
IDE 2.0 RC
Scala Toolchain
At a tipping point
Toolchain options
o SBT w/ Text editor
Flexible, multiplatform, complex, compatible with
Maven, documentation lacking
Compatible with IDEs
o Maven consider this only if you already use Maven
o Eclipse Usable
o IntelliJ IDEA Usable
o Netbeans Not popular, not well supported
o Ant Not popular but works fine
Companies Using Scala
19
Use Case: guardian.co.uk
100,000 lines of code.
Spring, Velocity, Hibernate, Oracle DB,
Maven.
Full release every 2 weeks.
Wrote integration tests using ScalaTest.
After a month of writing tests in Scala, they
converted the whole site to Scala.
Java and Scala code co-existed and
depended on each other
Use Case: Wordnik
5:1 reduction in code
Corresponding increase in quality
Maintenance costs decreased similarly
Scala attracts good developers
Typesafe was very responsive
REPL makes IDEs less important
Pattern matching was unexpected benefit
SBT love/hate
Never going back to Java

Non-Unique Enterprise Concerns
Performance
Scalability
Robustness
Politics
Enterprise Characteristics
Many locations
IT department often separate from
development teams
Legacy apps and data
Lots of SOAP
Big investment in JEE containers
Risk averse
Compliance issues
Budget for incremental change is small
portion of overall IT budget
Why Scala In the Enterprise?
Big scale, solid programs
Get more done
o More expressive
o Fewer lines of code
o More productive
o Strong community
o Fewer bugs (constant number of bugs/line of code)
Talent attractor
Horizontal Scale More Cores
Concurrency Is Too Hard
Multithreaded programs tend to be buggy
o Non-determinism caused by concurrent threads
accessing shared mutable state.
Actors and transactions manage state and
are therefore not a solution.
To get deterministic processing, avoid
mutable state.
This means functional programming.
Scala Offers Better Concurrency
Akka Composable futures*
Akka/Scala Dataflow*
Akka Actors
Scala Parallel collections
* Covered in my book:
Composable Futures with Akka 2.0
Scala / Java Class Definitions
Class Usage
Why Not Scala?
Steep learning curve
o New syntax
o Many new concepts
o Tools experiencing heavy growth
o Documentation still weak, not many books
o How to find a Scala programmer?
Grow instead of hire
JDK 8 will have closures
o Release Sept 2013
o Mass adoption 2017?
Scala Vocabulary
Lazy evaluation
Monads
Continuations
Recursion
Closures
Immutable datatypes
Currying
Higher order
functions
Composition
Pattern matching
Type extensions
Traits
Control structure
abstraction
Refined types
o Covariance
o Variance
o Type bounds
Who Should Introduce Scala into
an Enterprise?
Top down approach
o Gradual, planned implementation
Bottom up approach
o Skunk works
Sneak in on the side
o Custom project
Get toolchain working before including others
Types of Scala Applications
Web platforms
Trading platforms
Financial modeling
Simulation
Fast to first product, scalable afterwards
When to Use Scala?
Skunk works approach
o Gradual introduction minimizes risk
o No need to master all of Scala before using some of it
Save the company approach
o High risk, high gain
Where to Introduce Scala?
Address scalability issues
DSLs for problem statement
Testing: integration, black box, white box
o Lots of boilerplate; Scala removes it
o Tests focus on problem domain; DSLs help
o Users (non-programmers) can examine DSLs for
accuracy and maybe write code
Replace components
How to Use Scala?
Java 6+ or .NET is required
Choice of Java toolchain
o SBT, Maven, IntelliJ IDEA, Eclipse
o Jenkins/Hudson, other CI
.NET toolchain not yet ready for prime time
BUT:
o Can convert Java/Scala to .NET with IKVM
o Ive done it works well, easy to use

Thank you!
Mike Slinn
mslinn@micronauticsresearch.com

You might also like