SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Scala Next

SF Scala meetup Dec 8th, 2011
Scala Today




              2
Some adoption vectors:

  •  Web platforms

  •  Trading platforms

  •  Financial modeling

  •  Simulation

  Fast to first product, scalable
  afterwards
                                    3
Github vs. Stack Overflow




                                RedMonk: Revisiting the
                                 Dataists Programming
                                 Language Rankings

        Typesafe Confidential
                                                     4
Commercial Adoption
                             •  Scala jobs tripled
                                in last year
                             •  Now at estimated
                                100,000
                                developers




     Typesafe Confidential
                                                     5
(Only 17 months ago!)

Scala   New collections

2.8:    Package objects
        Context bounds
        Better implicits
        ...


                                      6
Parallel collections
               DelayedInit and App

Scala          Faster REPL
               Progress on IDEs:
2.9:             Eclipse, IntelliJ, Neatbeans,
                 ENSIME
               Better docs
               Lots of bug fixes
        	
  

                                                 7
Parallel Collections
•  Use Java 7 Fork Join framework
•  Split work by number of Processors
•  Each Thread has a work queue that is split
   exponentially. Largest on end of queue
•  Granularity balance against scheduling overhead
•  On completion threads “work steals” from end of other
   thread queues




                                                           8
... and its usage
                import	
  java.util.ArrayList;	
  
                ...	
  
                Person[]	
  people;	
  
                Person[]	
  minors;	
  
                Person[]	
  adults;	
  
                {	
  	
  ArrayList<Person>	
  minorsList	
  =	
  new	
  ArrayList<Person>();	
  
                	
  	
  	
  ArrayList<Person>	
  adultsList	
  =	
  new	
  ArrayList<Person>();	
  
... in Java:    	
  	
  	
  for	
  (int	
  i	
  =	
  0;	
  i	
  <	
  people.length;	
  i++)	
  
                	
  	
  	
  	
  	
  	
  	
  (people[i].age	
  <	
  18	
  ?	
  minorsList	
  :	
  adultsList)	
  
                          	
                 	
  	
  	
  	
  .add(people[i]);	
  
                	
  	
  	
  minors	
  =	
  minorsList.toArray(people);	
  
                	
  	
  	
  adults	
  =	
  adultsList.toArray(people);	
  
                }	
  
                                                                                                A function value
                	
  	
  
                                                          An infix method call


... in Scala:      val	
  people:	
  Array[Person]	
  
                   val	
  (minors,	
  adults)	
  =	
  people	
  partition	
  (_.age	
  <	
  18)	
  

                                   A simple pattern match                                                          9
Going Parallel

                                                  	
  
... in Java:                                         ?           	
  




... in Scala:   val	
  people:	
  Array[Person]	
  
                val	
  (minors,	
  adults)	
  =	
  people.par	
  partition	
  (_.age	
  <	
  18)	
  

                                                                                                       10
General Collection Hierarchy
                       Remove this layer in 2.10?


                GenTraversable

                  GenIterable
Traversable
                    GenSeq
 Iterable                             ParIterable

   Seq                                   ParSeq




                                                    11
Going Distributed
•  Can we get the power of parallel collections to work on
   10’000s of computers?
•  Hot technologies: MapReduce (Google’s and Hadoop)
•  But not everything is easy to fit into that mold
•  Sometimes 100’s of map-reduce steps are needed.
•  Distributed collections retain most operations, provide a
   powerful frontend for MapReduce computations.
•  Scala’s uniform collection model is designed to also
   accommodate parallel and distributed.
•  Projects at Google (Cascade), Berkeley (Spark), EPFL.


                                                               12
Scala   Eclipse IDE


next:   Play web framework 2.0

        Akka 2.0

        Scala 2.10




                                 13
Scala     Now in RC2
          Final expected before the end of
             the year.
Eclipse
IDE

                                             14
Goals

reliable (no crashes/lock ups)
responsive (never wait when typing)
work with large projects/files
   –  Scala compiler (80k LOC), 4-5000 LOC/file
   –  advanced use of the type system:
      path-dependent types, self-types, mix-ins
Features
Keep it simple
   –    highlight errors as you type
   –    completions (including implicits)
   –    hyperlinking
   –    project builder (+ dependent projects)
Support mixed Java-Scala projects
   –  all features should work between Java/Scala sources
JUnit Test Runner should pick up tests
More stuff based on external libraries
   –  (some) refactoring, code formatter, mark occurrences, structured
      selections, show inferred semi-colons
Features (3)
based on external libraries
   –    (some) refactoring
   –    code formatter
   –    mark occurrences
   –    structured selections
   –    show inferred semi-colons
@jonifreeman
Joni Freeman

Latest Scala Eclipse plugin works surprisingly well! Even manages our
mixed Java/Scala project. Kudos to the team! #scala



@esorribas
Eduardo Sorribas

The latest beta of the Scala IDE for eclipse is much better. I'm starting
to like it.


@jannehietamaki
Janne Hietamäki

After years of misery, the Eclipse Scala plugin actually seems to work
quite well.
Architecture
Use the full-blown Scala compiler for:
   –  interactive error highlight, completion, hyperlinking
   –  turning Scala symbols into Java model elements



Weave the JDT compiler when it needs help
   –  JDT was NOT meant to be extended
Why rely on scalac?

  –  reuse (type-checker == 1-2 person years)

  –  consistency

  –  compiler plugins

Why not?

  –  SPEED

  –  (very) tight dependency on the Scala version
asynchronous
interruptible
targeted
stop after type-checking




   Presentation
     Compiler
Result is communicated through a SyncVar
•  All compiler activity happens on PC thread
•  compile loaded files when work queue is empty (in the
   background)
•  Check work queue when type checker reaches safe-points in
   the AST
•  Drop everything when a file is changed (AskReload)
Implementation

26
1 type-checker run / instance --> 100s of type-check runs / minute
   –  memory leaks
   –  side-effects/state
   –  out-of-order and targeted type-checking


needed to improve the compiler
   –  2.9.x, 2.10 (trunk)
   –  what about 2.8?
       2.8.2, 2.8.3-SNAPSHOT
New: Play Framework 2.0
•  Play Framework is an open source web application
   framework, inspired by Ruby on Rails, for Java and Scala
•  Play Framework 2.0 retains full Java support while moving
   to a Scala core and builds on key pieces of the Typesafe
   Stack, including Akka middleware and SBT
•  Play will be integrated in TypeSafe stack 2.0
•  Typesafe will contribute to development and provide
   commercial support and maintenance.
Roadmap


May 2011      Oct 2011      Q1 2012        Q3 2012


Typesafe      Typesafe      Typesafe      Typesafe
Stack 1.0     Stack 1.1     Stack 2.0     Stack 2.x

Scala 2.9.0   Scala 2.9.1   Scala 2.9.x   Scala 2.10
 Akka 1.1      Akka 1.2      Akka 2.0      Akka 2.x
                             Play 2.0      Play 2.x
                                          Slick (DB)
1.  New reflection framework

Scala   2. 
        3. 
            Reification
            type Dynamic	
  

2.10:   4.  More IDE improvements: find-
            references, debugger,
            worksheet.
        5.  Faster builds
        6.  SIPs: string interpolation,
            simpler implicits.

        ETA: Early 2012.

                                           30
New in Scala 2.10: Dynamic
Type Dynamic bridges the gap between static and dynamic typing.
Method calls get translated to applyDynamic
Great for interfacing with dynamic languages (e.g. JavaScript)



 class JS extends Dynamic {	
     def applyDynamic(methName: String, args: Any*): Any = {	
        println("apply dynamic "+methName+args.mkString("(", ",", ")"))	
     }	
  }	
  	
  val x = new JS	
  x.foo(1)        	// à x.applyDynamic( foo , 1)	
  x.bar           	// à x.applyDynamic( bar )	
  




                                                                           31
Proposed for Scala 2.10:
                      SIP 11: String interpolation
Idea: Instead of
       	
   Bob	
  is	
   	
  +	
  n	
  +	
   years	
  old 	
  
write:
       	
  s Bob	
  is	
  $n	
  years	
  old 	
  
which gets translated to
       	
  new	
  StringContext( Bob	
  is ,	
   years	
  old ).s(n)	
  
Here, s is a library-defined method for string interpolation.	
  
	
  


	
  
	
  
       	
  	
                                                              32
This can be generalized to other string processors besides s:
           xml 	
  
       	
  	
  	
  <body>	
  
       	
            	
  <a	
  href	
  =	
   some	
  link >	
  ${linktext}	
  </a>	
  
       	
  	
  	
  </body>	
  
       	
   	
  
	
  
	
  
       	
  scala 	
  
       	
  	
  	
  scala.concurrent.transaction.withinTransaction	
  {	
  
       	
  	
  	
  	
  	
  (implicit	
  currentTransaction:	
  Transaction)	
  =>	
  
       	
                  	
  $expr	
  
       	
  	
  	
  }	
  
       	
   	
  



                                                                                         33
Proposed for Scala 2.10:
                       SIP 12: Uncluttering control
Should be able to write:
	
  
       	
  if	
  x	
  <	
  0	
  then	
  –x	
  else	
  x	
  
	
  
       	
  while	
  x	
  >	
  0	
  do	
  {	
  println(x);	
  x	
  -­‐=	
  1	
  }	
  
	
  
       	
  for	
  x	
  <-­‐	
  xs	
  do	
  println(x)	
  
	
  
       	
  for	
  x	
  <-­‐	
  xs	
  yield	
  x	
  *	
  x	
  


	
  
	
                                                                                     34
Proposed for Scala 2.10:
             SIP 13: Implicit classes




Variation:
  Add @inline	
  to class def to get speed of extension methods.

                                                                   35
New in Scala 2.10: Reflection
Previously: Needed to use Java reflection,
no runtime info available on Scala s types.

Now you can do:




                                              36
(Bare-Bones) Reflection in Java

                                             Why not add some
                                             meaningful operations?


                                             Need to write essential
                                             parts of a compiler
                                             (hard).


                                             Need to ensure that
                                             both compilers agree
                                             (almost impossible).
Want to know whether type A conforms to B?
Write your own Java compiler!
                                             	
  

                                                                 37
How to do Better?
•  Problem is managing dependencies between compiler and
   reflection.
•  Time to look at DI again.


                Dependency Injection
•  Idea: Avoid hard dependencies to specific classes.
•  Instead of calling specific classes with new, have someone else do
   the wiring.




                                                                        38
Using Guice for Dependency Injection




                         (Example by Jan Kriesten)
                                                     39
... plus some Boilerplate




                            40
Dependency Injection in Scala

    Components are
    classes or traits



                                                 Requirements are
                                                  abstract values




                        Wiring by implementing
                         requirement values

              But what about cyclic dependencies?
                                                               41
The Cake Pattern

Components are traits


        Wiring by mixin
         composition




                          Requirements are
                           types of this	
  



                                               42
Cake Pattern in the Compiler
The Scala compiler uses the cake pattern for everything
Here s a schema:




(In reality there are about ~20 slices in the cake.)



                                                          43
Towards Better Reflection
Can we unify the core parts of the compiler and reflection?




            Compiler                             Reflection




Different requirements: Error diagnostics, file access, classpath
   handling - but we are close!


                                                                    44
Compiler Architecture

Problem: This exposes way too much detail!


                                      reflect.internal.Universe	
  




    nsc.Global	
  (scalac)        reflect.runtime.Mirror	
  

                                                                      45
Complete Reflection Architecture
                                 reflect.api.Universe	
  /	
  
   Cleaned-up facade:
                                 reflect.mirror	
  




                                    reflect.internal.Universe	
  

Full implementation:




       nsc.Global	
  (scalac)   reflect.runtime.Mirror	
  

                                                                    46
How to Make a Facade

      The Facade



                   Interfaces are not enough!




             The Implementation

                                                47
Conclusion
Scala is a very regular language when it comes to composition:

1.  Everything can be nested:
   –    classes, methods, objects, types
2.  Everything can be abstract:
   –    methods, values, types
3.  The type of this can be declared freely, can thus express
    dependencies
4.  This gives great flexibility for SW architecture, allows us to attack
    previously unsolvable problems.




                                                                            48
Going further: Parallel DSLs

Mid term, research project: How do we keep tomorrow s
  computers loaded?
   –  How to find and deal with 10000+ threads in an
      application?
  –  Parallel collections and actors are necessary but not
     sufficient for this.
Our bet for the mid term future: parallel embedded DSLs.
   –  Find parallelism in domains: physics simulation, machine
      learning, statistics, ...
Joint work with Kunle Olukuton, Pat Hanrahan @ Stanford.
EPFL side funded by ERC.

                                                                 49
EPFL / Stanford Research
                   Scientific              Virtual                  Personal                     Data
 Applications     Engineering              Worlds                   Robotics                 informatics


  Domain
                                    Physics                             Probabilistic             Machine
  Specific       Rendering                           Scripting                                    Learning
 Languages                           (Liszt)                             (RandomT)                (OptiML)


                                        Domain Embedding Language (Scala)
                       Polymorphic Embedding              Staging            Static Domain Specific Opt.
     DSL
Infrastructure
                                     Parallel Runtime (Delite, Sequoia, GRAMPS)
                  Dynamic Domain Spec. Opt.        Task & Data Parallelism        Locality Aware Scheduling



                                               Hardware Architecture
Heterogeneous
                   OOO Cores          SIMD Cores           Threaded Cores               Specialized Cores
  Hardware
                     Programmable         Scalable        Isolation &        On-chip        Pervasive
                      Hierarchies        Coherence         Atomicity         Networks       Monitoring
                                                                                                            50
Example: Liszt - A DSL for Physics
                 Simulation

                                                            Combustion

                                    Turbulence



                                                      Fuel injection
                                         Transition                      Thermal
•  Mesh-based
•  Numeric Simulation
•  Huge domains                     Turbulence


   –  millions of cells
•  Example: Unstructured Reynolds-averaged Navier
   Stokes (RANS) solver




                                                                                   51
Liszt as Virtualized Scala
val // calculating scalar convection (Liszt)

val Flux = new Field[Cell,Float]                              AST
val Phi = new Field[Cell,Float]
val cell_volume = new Field[Cell,Float]
val deltat = .001
...
untilconverged {
  for(f <- interior_faces) {
    val flux = calc_flux(f)
    Flux(inside(f)) -= flux
    Flux(outside(f)) += flux
  }
  for(f <- inlet_faces) {                                       Optimisers Generators
    Flux(outside(f)) += calc_boundary_flux(f)
  }                                                                       …
  for(c <- cells(mesh)) {
    Phi(c) += deltat * Flux(c) /cell_volume                            Schedulers
    (c)
  }                                                                        …
  for(f <- faces(mesh))
    Flux(f) = 0.f                                                       Hardware
}

                                                DSL Library         GPU, Multi-Core, etc

                                                                                       52
Follow us on twitter: @typesafe
                 akka.io

scala-lang.org




                                      typesafe.com

                     scala-lang.org
                                                     53

Contenu connexe

Tendances

How Scala code is expressed in the JVM
How Scala code is expressed in the JVMHow Scala code is expressed in the JVM
How Scala code is expressed in the JVMKoichi Sakata
 
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 TwitterAlex Payne
 
Scala in practice
Scala in practiceScala in practice
Scala in practiceTomer Gabel
 
Mongony aug10
Mongony aug10Mongony aug10
Mongony aug10bwmcadams
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overviewstasimus
 
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, TokyoTaro L. Saito
 
Neo4 + Grails
Neo4 + GrailsNeo4 + Grails
Neo4 + Grailsstasimus
 
Scala Matsuri 2016: Japanese Text Mining with Scala and Spark
Scala Matsuri 2016: Japanese Text Mining with Scala and SparkScala Matsuri 2016: Japanese Text Mining with Scala and Spark
Scala Matsuri 2016: Japanese Text Mining with Scala and SparkEduardo Gonzalez
 
Model Manipulation Using Embedded DSLs in Scala
Model Manipulation Using Embedded DSLs in ScalaModel Manipulation Using Embedded DSLs in Scala
Model Manipulation Using Embedded DSLs in ScalaFilip Krikava
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterpriseRafael Bagmanov
 
Scalany mongodb aug10
Scalany mongodb aug10Scalany mongodb aug10
Scalany mongodb aug10bwmcadams
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentationGene Chang
 
Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in ScalaAlex Payne
 
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)Tomer Gabel
 
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVMQCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVMPeter Pilgrim
 
Scaling software with akka
Scaling software with akkaScaling software with akka
Scaling software with akkascalaconfjp
 
BOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsBOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsPeter Pilgrim
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesPeter Pilgrim
 

Tendances (19)

Scala Days NYC 2016
Scala Days NYC 2016Scala Days NYC 2016
Scala Days NYC 2016
 
How Scala code is expressed in the JVM
How Scala code is expressed in the JVMHow Scala code is expressed in the JVM
How Scala code is expressed in the JVM
 
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
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Mongony aug10
Mongony aug10Mongony aug10
Mongony aug10
 
Concurrency Constructs Overview
Concurrency Constructs OverviewConcurrency Constructs Overview
Concurrency Constructs Overview
 
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
 
Neo4 + Grails
Neo4 + GrailsNeo4 + Grails
Neo4 + Grails
 
Scala Matsuri 2016: Japanese Text Mining with Scala and Spark
Scala Matsuri 2016: Japanese Text Mining with Scala and SparkScala Matsuri 2016: Japanese Text Mining with Scala and Spark
Scala Matsuri 2016: Japanese Text Mining with Scala and Spark
 
Model Manipulation Using Embedded DSLs in Scala
Model Manipulation Using Embedded DSLs in ScalaModel Manipulation Using Embedded DSLs in Scala
Model Manipulation Using Embedded DSLs in Scala
 
Scala in a wild enterprise
Scala in a wild enterpriseScala in a wild enterprise
Scala in a wild enterprise
 
Scalany mongodb aug10
Scalany mongodb aug10Scalany mongodb aug10
Scalany mongodb aug10
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
 
Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in Scala
 
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)
 
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVMQCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
QCon 2015 Scala for the Enterprise: Get FuNkEd Up on the JVM
 
Scaling software with akka
Scaling software with akkaScaling software with akka
Scaling software with akka
 
BOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala appsBOF2644 Developing Java EE 7 Scala apps
BOF2644 Developing Java EE 7 Scala apps
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
 

Similaire à Martin Odersky: What's next for Scala

Scala overview
Scala overviewScala overview
Scala overviewSteve Min
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistpmanvi
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San FranciscoMartin Odersky
 
Martin Odersky - Evolution of Scala
Martin Odersky - Evolution of ScalaMartin Odersky - Evolution of Scala
Martin Odersky - Evolution of ScalaScala Italy
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdfHiroshi Ono
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark Summit
 
Infographic on Scala Programming Language
Infographic on Scala Programming LanguageInfographic on Scala Programming Language
Infographic on Scala Programming LanguagePaddy Lock
 
Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Salesforce Developers
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
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 IGNManish Pandit
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
 
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 RecapDave Orme
 
Oscon keynote: Working hard to keep it simple
Oscon keynote: Working hard to keep it simpleOscon keynote: Working hard to keep it simple
Oscon keynote: Working hard to keep it simpleMartin Odersky
 
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...Codemotion
 

Similaire à Martin Odersky: What's next for Scala (20)

Devoxx
DevoxxDevoxx
Devoxx
 
Scala overview
Scala overviewScala overview
Scala overview
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologist
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San Francisco
 
Martin Odersky - Evolution of Scala
Martin Odersky - Evolution of ScalaMartin Odersky - Evolution of Scala
Martin Odersky - Evolution of Scala
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
scalaliftoff2009.pdf
scalaliftoff2009.pdfscalaliftoff2009.pdf
scalaliftoff2009.pdf
 
Spark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin OderskySpark - The Ultimate Scala Collections by Martin Odersky
Spark - The Ultimate Scala Collections by Martin Odersky
 
Infographic on Scala Programming Language
Infographic on Scala Programming LanguageInfographic on Scala Programming Language
Infographic on Scala Programming Language
 
Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"Scala - from "Hello, World" to "Heroku Scale"
Scala - from "Hello, World" to "Heroku Scale"
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Lecture1
Lecture1Lecture1
Lecture1
 
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
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
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
 
Quick introduction to scala
Quick introduction to scalaQuick introduction to scala
Quick introduction to scala
 
Oscon keynote: Working hard to keep it simple
Oscon keynote: Working hard to keep it simpleOscon keynote: Working hard to keep it simple
Oscon keynote: Working hard to keep it simple
 
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
Sviluppare applicazioni nell'era dei "Big Data" con Scala e Spark - Mario Car...
 

Plus de Marakana Inc.

Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaMarakana Inc.
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentMarakana Inc.
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical DataMarakana Inc.
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android SecurityMarakana Inc.
 
Pictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupPictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupMarakana Inc.
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesMarakana Inc.
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6Marakana Inc.
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Marakana Inc.
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Marakana Inc.
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationMarakana Inc.
 
jQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzjQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzMarakana Inc.
 
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Marakana Inc.
 
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldEfficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldMarakana Inc.
 
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldEfficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldMarakana Inc.
 
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboLearn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboMarakana Inc.
 
Replacing Java Incrementally
Replacing Java IncrementallyReplacing Java Incrementally
Replacing Java IncrementallyMarakana Inc.
 
Learn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrLearn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrMarakana Inc.
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Marakana Inc.
 

Plus de Marakana Inc. (20)

Android Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar GargentaAndroid Services Black Magic by Aleksandar Gargenta
Android Services Black Magic by Aleksandar Gargenta
 
JRuby at Square
JRuby at SquareJRuby at Square
JRuby at Square
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Why Java Needs Hierarchical Data
Why Java Needs Hierarchical DataWhy Java Needs Hierarchical Data
Why Java Needs Hierarchical Data
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
Securing Android
Securing AndroidSecuring Android
Securing Android
 
Pictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User GroupPictures from "Learn about RenderScript" meetup at SF Android User Group
Pictures from "Learn about RenderScript" meetup at SF Android User Group
 
Android UI Tips, Tricks and Techniques
Android UI Tips, Tricks and TechniquesAndroid UI Tips, Tricks and Techniques
Android UI Tips, Tricks and Techniques
 
2010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-62010 07-18.wa.rails tdd-6
2010 07-18.wa.rails tdd-6
 
Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6Efficient Rails Test-Driven Development - Week 6
Efficient Rails Test-Driven Development - Week 6
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)
 
What's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovationWhat's this jQuery? Where it came from, and how it will drive innovation
What's this jQuery? Where it came from, and how it will drive innovation
 
jQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda KatzjQuery State of the Union - Yehuda Katz
jQuery State of the Union - Yehuda Katz
 
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
Pics from: "James Gosling on Apple, Apache, Google, Oracle and the Future of ...
 
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram ArnoldEfficient Rails Test Driven Development (class 4) by Wolfram Arnold
Efficient Rails Test Driven Development (class 4) by Wolfram Arnold
 
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram ArnoldEfficient Rails Test Driven Development (class 3) by Wolfram Arnold
Efficient Rails Test Driven Development (class 3) by Wolfram Arnold
 
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas EneboLearn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
Learn about JRuby Internals from one of the JRuby Lead Developers, Thomas Enebo
 
Replacing Java Incrementally
Replacing Java IncrementallyReplacing Java Incrementally
Replacing Java Incrementally
 
Learn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache BuildrLearn to Build like you Code with Apache Buildr
Learn to Build like you Code with Apache Buildr
 
Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)Learn How to Unit Test Your Android Application (with Robolectric)
Learn How to Unit Test Your Android Application (with Robolectric)
 

Dernier

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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.pptxHampshireHUG
 
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 SolutionsEnterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Martin Odersky: What's next for Scala

  • 1. Scala Next SF Scala meetup Dec 8th, 2011
  • 3. Some adoption vectors: •  Web platforms •  Trading platforms •  Financial modeling •  Simulation Fast to first product, scalable afterwards 3
  • 4. Github vs. Stack Overflow RedMonk: Revisiting the Dataists Programming Language Rankings Typesafe Confidential 4
  • 5. Commercial Adoption •  Scala jobs tripled in last year •  Now at estimated 100,000 developers Typesafe Confidential 5
  • 6. (Only 17 months ago!) Scala New collections 2.8: Package objects Context bounds Better implicits ... 6
  • 7. Parallel collections DelayedInit and App Scala Faster REPL Progress on IDEs: 2.9: Eclipse, IntelliJ, Neatbeans, ENSIME Better docs Lots of bug fixes   7
  • 8. Parallel Collections •  Use Java 7 Fork Join framework •  Split work by number of Processors •  Each Thread has a work queue that is split exponentially. Largest on end of queue •  Granularity balance against scheduling overhead •  On completion threads “work steals” from end of other thread queues 8
  • 9. ... and its usage import  java.util.ArrayList;   ...   Person[]  people;   Person[]  minors;   Person[]  adults;   {    ArrayList<Person>  minorsList  =  new  ArrayList<Person>();        ArrayList<Person>  adultsList  =  new  ArrayList<Person>();   ... in Java:      for  (int  i  =  0;  i  <  people.length;  i++)                (people[i].age  <  18  ?  minorsList  :  adultsList)            .add(people[i]);        minors  =  minorsList.toArray(people);        adults  =  adultsList.toArray(people);   }   A function value     An infix method call ... in Scala: val  people:  Array[Person]   val  (minors,  adults)  =  people  partition  (_.age  <  18)   A simple pattern match 9
  • 10. Going Parallel   ... in Java: ?   ... in Scala: val  people:  Array[Person]   val  (minors,  adults)  =  people.par  partition  (_.age  <  18)   10
  • 11. General Collection Hierarchy Remove this layer in 2.10? GenTraversable GenIterable Traversable GenSeq Iterable ParIterable Seq ParSeq 11
  • 12. Going Distributed •  Can we get the power of parallel collections to work on 10’000s of computers? •  Hot technologies: MapReduce (Google’s and Hadoop) •  But not everything is easy to fit into that mold •  Sometimes 100’s of map-reduce steps are needed. •  Distributed collections retain most operations, provide a powerful frontend for MapReduce computations. •  Scala’s uniform collection model is designed to also accommodate parallel and distributed. •  Projects at Google (Cascade), Berkeley (Spark), EPFL. 12
  • 13. Scala Eclipse IDE next: Play web framework 2.0 Akka 2.0 Scala 2.10 13
  • 14. Scala Now in RC2 Final expected before the end of the year. Eclipse IDE 14
  • 15. Goals reliable (no crashes/lock ups) responsive (never wait when typing) work with large projects/files –  Scala compiler (80k LOC), 4-5000 LOC/file –  advanced use of the type system: path-dependent types, self-types, mix-ins
  • 16. Features Keep it simple –  highlight errors as you type –  completions (including implicits) –  hyperlinking –  project builder (+ dependent projects) Support mixed Java-Scala projects –  all features should work between Java/Scala sources JUnit Test Runner should pick up tests More stuff based on external libraries –  (some) refactoring, code formatter, mark occurrences, structured selections, show inferred semi-colons
  • 17. Features (3) based on external libraries –  (some) refactoring –  code formatter –  mark occurrences –  structured selections –  show inferred semi-colons
  • 18. @jonifreeman Joni Freeman Latest Scala Eclipse plugin works surprisingly well! Even manages our mixed Java/Scala project. Kudos to the team! #scala @esorribas Eduardo Sorribas The latest beta of the Scala IDE for eclipse is much better. I'm starting to like it. @jannehietamaki Janne Hietamäki After years of misery, the Eclipse Scala plugin actually seems to work quite well.
  • 19. Architecture Use the full-blown Scala compiler for: –  interactive error highlight, completion, hyperlinking –  turning Scala symbols into Java model elements Weave the JDT compiler when it needs help –  JDT was NOT meant to be extended
  • 20. Why rely on scalac? –  reuse (type-checker == 1-2 person years) –  consistency –  compiler plugins Why not? –  SPEED –  (very) tight dependency on the Scala version
  • 22.
  • 23.
  • 24. Result is communicated through a SyncVar
  • 25. •  All compiler activity happens on PC thread •  compile loaded files when work queue is empty (in the background) •  Check work queue when type checker reaches safe-points in the AST •  Drop everything when a file is changed (AskReload)
  • 27. 1 type-checker run / instance --> 100s of type-check runs / minute –  memory leaks –  side-effects/state –  out-of-order and targeted type-checking needed to improve the compiler –  2.9.x, 2.10 (trunk) –  what about 2.8? 2.8.2, 2.8.3-SNAPSHOT
  • 28. New: Play Framework 2.0 •  Play Framework is an open source web application framework, inspired by Ruby on Rails, for Java and Scala •  Play Framework 2.0 retains full Java support while moving to a Scala core and builds on key pieces of the Typesafe Stack, including Akka middleware and SBT •  Play will be integrated in TypeSafe stack 2.0 •  Typesafe will contribute to development and provide commercial support and maintenance.
  • 29. Roadmap May 2011 Oct 2011 Q1 2012 Q3 2012 Typesafe Typesafe Typesafe Typesafe Stack 1.0 Stack 1.1 Stack 2.0 Stack 2.x Scala 2.9.0 Scala 2.9.1 Scala 2.9.x Scala 2.10 Akka 1.1 Akka 1.2 Akka 2.0 Akka 2.x Play 2.0 Play 2.x Slick (DB)
  • 30. 1.  New reflection framework Scala 2.  3.  Reification type Dynamic   2.10: 4.  More IDE improvements: find- references, debugger, worksheet. 5.  Faster builds 6.  SIPs: string interpolation, simpler implicits. ETA: Early 2012. 30
  • 31. New in Scala 2.10: Dynamic Type Dynamic bridges the gap between static and dynamic typing. Method calls get translated to applyDynamic Great for interfacing with dynamic languages (e.g. JavaScript) class JS extends Dynamic { def applyDynamic(methName: String, args: Any*): Any = { println("apply dynamic "+methName+args.mkString("(", ",", ")")) } } val x = new JS x.foo(1) // à x.applyDynamic( foo , 1) x.bar // à x.applyDynamic( bar )   31
  • 32. Proposed for Scala 2.10: SIP 11: String interpolation Idea: Instead of   Bob  is    +  n  +   years  old   write:  s Bob  is  $n  years  old   which gets translated to  new  StringContext( Bob  is ,   years  old ).s(n)   Here, s is a library-defined method for string interpolation.             32
  • 33. This can be generalized to other string processors besides s: xml        <body>      <a  href  =   some  link >  ${linktext}  </a>        </body>            scala        scala.concurrent.transaction.withinTransaction  {            (implicit  currentTransaction:  Transaction)  =>      $expr        }       33
  • 34. Proposed for Scala 2.10: SIP 12: Uncluttering control Should be able to write:    if  x  <  0  then  –x  else  x      while  x  >  0  do  {  println(x);  x  -­‐=  1  }      for  x  <-­‐  xs  do  println(x)      for  x  <-­‐  xs  yield  x  *  x       34
  • 35. Proposed for Scala 2.10: SIP 13: Implicit classes Variation: Add @inline  to class def to get speed of extension methods. 35
  • 36. New in Scala 2.10: Reflection Previously: Needed to use Java reflection, no runtime info available on Scala s types. Now you can do: 36
  • 37. (Bare-Bones) Reflection in Java Why not add some meaningful operations? Need to write essential parts of a compiler (hard). Need to ensure that both compilers agree (almost impossible). Want to know whether type A conforms to B? Write your own Java compiler!   37
  • 38. How to do Better? •  Problem is managing dependencies between compiler and reflection. •  Time to look at DI again. Dependency Injection •  Idea: Avoid hard dependencies to specific classes. •  Instead of calling specific classes with new, have someone else do the wiring. 38
  • 39. Using Guice for Dependency Injection (Example by Jan Kriesten) 39
  • 40. ... plus some Boilerplate 40
  • 41. Dependency Injection in Scala Components are classes or traits Requirements are abstract values Wiring by implementing requirement values But what about cyclic dependencies? 41
  • 42. The Cake Pattern Components are traits Wiring by mixin composition Requirements are types of this   42
  • 43. Cake Pattern in the Compiler The Scala compiler uses the cake pattern for everything Here s a schema: (In reality there are about ~20 slices in the cake.) 43
  • 44. Towards Better Reflection Can we unify the core parts of the compiler and reflection? Compiler Reflection Different requirements: Error diagnostics, file access, classpath handling - but we are close! 44
  • 45. Compiler Architecture Problem: This exposes way too much detail! reflect.internal.Universe   nsc.Global  (scalac) reflect.runtime.Mirror   45
  • 46. Complete Reflection Architecture reflect.api.Universe  /   Cleaned-up facade: reflect.mirror   reflect.internal.Universe   Full implementation: nsc.Global  (scalac) reflect.runtime.Mirror   46
  • 47. How to Make a Facade The Facade Interfaces are not enough! The Implementation 47
  • 48. Conclusion Scala is a very regular language when it comes to composition: 1.  Everything can be nested: –  classes, methods, objects, types 2.  Everything can be abstract: –  methods, values, types 3.  The type of this can be declared freely, can thus express dependencies 4.  This gives great flexibility for SW architecture, allows us to attack previously unsolvable problems. 48
  • 49. Going further: Parallel DSLs Mid term, research project: How do we keep tomorrow s computers loaded? –  How to find and deal with 10000+ threads in an application? –  Parallel collections and actors are necessary but not sufficient for this. Our bet for the mid term future: parallel embedded DSLs. –  Find parallelism in domains: physics simulation, machine learning, statistics, ... Joint work with Kunle Olukuton, Pat Hanrahan @ Stanford. EPFL side funded by ERC. 49
  • 50. EPFL / Stanford Research Scientific Virtual Personal Data Applications Engineering Worlds Robotics informatics Domain Physics Probabilistic Machine Specific Rendering Scripting Learning Languages (Liszt) (RandomT) (OptiML) Domain Embedding Language (Scala) Polymorphic Embedding Staging Static Domain Specific Opt. DSL Infrastructure Parallel Runtime (Delite, Sequoia, GRAMPS) Dynamic Domain Spec. Opt. Task & Data Parallelism Locality Aware Scheduling Hardware Architecture Heterogeneous OOO Cores SIMD Cores Threaded Cores Specialized Cores Hardware Programmable Scalable Isolation & On-chip Pervasive Hierarchies Coherence Atomicity Networks Monitoring 50
  • 51. Example: Liszt - A DSL for Physics Simulation Combustion Turbulence Fuel injection Transition Thermal •  Mesh-based •  Numeric Simulation •  Huge domains Turbulence –  millions of cells •  Example: Unstructured Reynolds-averaged Navier Stokes (RANS) solver 51
  • 52. Liszt as Virtualized Scala val // calculating scalar convection (Liszt) val Flux = new Field[Cell,Float] AST val Phi = new Field[Cell,Float] val cell_volume = new Field[Cell,Float] val deltat = .001 ... untilconverged { for(f <- interior_faces) { val flux = calc_flux(f) Flux(inside(f)) -= flux Flux(outside(f)) += flux } for(f <- inlet_faces) { Optimisers Generators Flux(outside(f)) += calc_boundary_flux(f) } … for(c <- cells(mesh)) { Phi(c) += deltat * Flux(c) /cell_volume Schedulers (c) } … for(f <- faces(mesh)) Flux(f) = 0.f Hardware } DSL Library GPU, Multi-Core, etc 52
  • 53. Follow us on twitter: @typesafe akka.io scala-lang.org typesafe.com scala-lang.org 53