scala adoption by enterprises

37
Scala Adoption by Enterprises Mike Slinn April 2, 2012 SuccessFactors, an SAP Company

Upload: mslinn

Post on 23-Nov-2015

22 views

Category:

Documents


0 download

DESCRIPTION

Useful for enterprises considering Scala

TRANSCRIPT

Hanuman Scala, Akka, Actors, BlueEyes

Scala Adoption by EnterprisesMike SlinnApril 2, 2012

SuccessFactors, an SAP CompanyAbout Mike SlinnPrincipal at Micronautics Research CorporationHands-on architect, mentor, trainerInterim technical leader for companies in transitionRecognized in US Federal court as a software expert Author of Composable Futures with Akka 2.0Twitter: mslinn

About You, the Attendees___% Managers___% Full-time programmers___% InternsProgrammers___% New to Scala___% Intermediate Scala programmers___% Expert Scala programmers___% Currently work on Scala projects___% Windows, Linux, Mac, other

Modified from scalaBin (norwegian scala user group) logoJames GoslingIf I were to pick a language to use today other than Java, it would be Scala

Father of JavaJames StrachanIf someone had shown me the Programming in Scala book in 2003, I would not have created Groovy.

Groovy Language & Apache Camel bookAlex PayneJoy is underrated as a metric for a language's potential success in a development organization

Early Twitter engineer, co-author of Programming ScalaWhat is Scala?Natural progression on the JVMSame deployment mechanism as JavaScale up and out, with concurrency and/or parallelismJava.util.concurrentScala Parallel collectionsActorsFutures (allows map/reduce)DataflowMap/reduce frameworksScala vs. Other OO & FP LanguagesJavaScalaClojureRubyTypingStaticStaticDynamicDynamicParadigmOOOO & FPFPOOTwo Types of ProgrammingImperative ProgrammingDescribes computation in terms of statements that change program stateFunctional ProgrammingDescribes computation in terms of mathematical functions, avoiding state and mutable dataScala is Object-OrientedPrimitives are full objectsStatic methods are attached to singletonsImperative styleYou can use Scala simply as a better JavaScala is Also FunctionalTransform data objects instead of mutationStrong list processing (e.g. map and reduce)Thread-safeParallelizableSupports compositionStack Overflow / GitHub Popularity

Image from Martin OderskyCommercial AdoptionScala jobs tripled last year100,000 current developers?

Image from Martin Odersky Dec 2011.Geoffrey Moorestechnology adoption lifecyle

Gartners Hype Cycle

Scala 2012 RoadmapTypesafe Stack 1.0

Typesafe Stack 1.1

Typesafe Stack 2.0

Typesafe Stack 2.1

May 2011Oct 2011Q1 2012Q3 2012Scala 2.9.0Akka 1.1Scala 2.9.1Akka 1.2IDE 1.0Scala 2.9.2Akka 2.0Play 2.0SBT 0.11.2IDE 2.0 M1Scala 2.10Akka 2.1Play 2.1Slick (DB)IDE 2.0 RCI updated Martin Oderskys slides from @ SF Scala Dec 2011Scala ToolchainAt a tipping pointToolchain options SBT w/ Text editorFlexible, multiplatform, complex, compatible with Maven, documentation lackingCompatible with IDEsMaven consider this only if you already use MavenEclipse UsableIntelliJ IDEA UsableNetbeans Not popular, not well supportedAnt Not popular but works fine

Companies Using Scala 19

From Martin Odersky @ SF Scala Dec 2011Use Case: guardian.co.uk100,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 otherUse Case: Wordnik5:1 reduction in codeCorresponding increase in qualityMaintenance costs decreased similarlyScala attracts good developersTypesafe was very responsiveREPL makes IDEs less importantPattern matching was unexpected benefitSBT love/hateNever going back to Java

Non-Unique Enterprise ConcernsPerformanceScalabilityRobustnessPoliticsEnterprise CharacteristicsMany locationsIT department often separate from development teamsLegacy apps and dataLots of SOAPBig investment in JEE containersRisk averseCompliance issuesBudget for incremental change is small portion of overall IT budgetWhy Scala In the Enterprise?Big scale, solid programsGet more doneMore expressiveFewer lines of codeMore productiveStrong communityFewer bugs (constant number of bugs/line of code)Talent attractorHorizontal Scale More Cores

Concurrency Is Too HardMultithreaded programs tend to be buggyNon-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 ConcurrencyAkka Composable futures*Akka/Scala Dataflow*Akka ActorsScala Parallel collections* Covered in my book: Composable Futures with Akka 2.0Scala / Java Class Definitions

Class Usage

Why Not Scala?Steep learning curveNew syntaxMany new conceptsTools experiencing heavy growthDocumentation still weak, not many booksHow to find a Scala programmer?Grow instead of hireJDK 8 will have closuresRelease Sept 2013Mass adoption 2017?Scala VocabularyLazy evaluationMonadsContinuationsRecursionClosuresImmutable datatypesCurryingHigher order functionsCompositionPattern matchingType extensionsTraitsControl structure abstractionRefined typesCovarianceVarianceType boundsWho Should Introduce Scala into an Enterprise?Top down approachGradual, planned implementationBottom up approachSkunk worksSneak in on the sideCustom projectGet toolchain working before including othersTypes of Scala ApplicationsWeb platformsTrading platformsFinancial modelingSimulationFast to first product, scalable afterwards When to Use Scala?Skunk works approachGradual introduction minimizes riskNo need to master all of Scala before using some of itSave the company approachHigh risk, high gainWhere to Introduce Scala?Address scalability issuesDSLs for problem statementTesting: integration, black box, white boxLots of boilerplate; Scala removes itTests focus on problem domain; DSLs helpUsers (non-programmers) can examine DSLs for accuracy and maybe write code Replace componentsHow to Use Scala?Java 6+ or .NET is requiredChoice of Java toolchainSBT, Maven, IntelliJ IDEA, EclipseJenkins/Hudson, other CI.NET toolchain not yet ready for prime timeBUT:Can convert Java/Scala to .NET with IKVMIve done it works well, easy to use

Thank you!

Mike [email protected]