SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
Taking Scala into the Enterprise

           Peter Pilgrim
       Oracle Java Champion
       ACCU Conference 2013
About the Speaker
•   Java Champion
•   Independent Contractor
•   Java since 1998
•   Scala since 2010




        13 April 2013   Xenonique ©2013   2
Agenda




• What’s New in Scala 2.10?
• Play Framework
• AKKA Framework

 13 April 2013    Xenonique ©2013   3
TypeSafe




13 April 2013     Xenonique ©2013   4
Simplicity




“I want a language with simple means to do interesting
things, which is not the same as a language to do only
simple things.” Prof. Martin Odersky
        13 April 2013      Xenonique ©2013               5
TypeSafe: The Company
• Founded in Summer 2011
• Based in Switzerland and
  headquartered in New York, USA
• Scala, Akka and Play Framework
• Professional Support for Scala




     13 April 2013   Xenonique ©2013   6
Growth of Scala Training
• Scala Solutions
• Dick Wall and Bill Venners,
  Escalate Solutions
• ScalaDays conference in London
  2012
• Scala content at JavaOne 2012



     13 April 2013   Xenonique ©2013   7
Scala Knowledge
• Hunger for more know-how
• Growing Awareness in Functional
  Programming
• Object Oriented Languages embrace
  FP principles
• JDK 8 Lambdas
• Clojure jobs at CitiBank, London &
  NY
     13 April 2013   Xenonique ©2013   8
Scala in Enterprise
•   Morgan Stanley
•   HSBC
•   Guardian UK
•   Twitter
•   Linked-In
•   Four Square



       13 April 2013   Xenonique ©2013   9
Scala Revision
                Demonstration of the simplicity




13 April 2013              Xenonique ©2013        10
Scalable Language




                  Still has a very bright future
Functional
                                             Purely Object-Oriented
      Statically-typed
                                                 JVM Language

      4/13/2013       XeNoNiQUe.co.uk (c) 2011                    11
Typing Derived from “Pascal”
  Tree of Computer Language

 <variableName> [: [ <Type> ]

              personName: String
                taxRate: Float
                density: Double
                 found: False
                persion: Person

    13 April 2013    Xenonique ©2013   12
Variables and Values
• Assignment less programming
• Prefer val over var

var   x = 10.0; x = 10 + x
val   y = 10.0
val   z: Float = x
var   t: Int = 42; t = t * 2

                                13
Scala Class
class Person (
    val firstName: String
    val lastName: String,
    val height: Float,
    val age: Int ) {
    // Write your definition here
}

     13 April 2013       Xenonique ©2013   14
Instances of Scala Classes

val p1 = new Person( "Billy",
"Mitchell", 5.10F, 42 )

val p2 = new Person( "Kat",
"Moon", 5.8F, 39 )



     13 April 2013   Xenonique ©2013   15
Companion Objects
object Person {
     private records = List[Person]()
     def apply(fn: String, ln: String,
          h: Float, a: Int): Person = {
         val p = new Person(fn, ln, h, a );
         records = p :: records.reverse //
O(1)
         return p
     }
     def recordCount() = records.size
}

       13 April 2013   Xenonique ©2013        16
Case Classes

class Transmission( driveTrain:
String )




     13 April 2013       Xenonique ©2013   17
Scala Functions

val isEven: (Int => Boolean) =             (k: Int) => k % 2 == 0




• Functions are values, values are object
• Ergo, functions are objects in Scala




         13 April 2013   Xenonique ©2013                            18
Scala Code
def uniqueSorted[Symbol]( p: List[Symbol] ): List[Symbol] = {
    val myOrdering =
       Ordering.fromLessThan[Symbol](
                _.toString < _.toString )
    var acc = SortedSet.empty(myOrdering)

     def compress0( q: List[Symbol] ): Unit = {
       q match {
         case Nil => Nil
         case x :: xs => { acc += x ; compress0(xs)   }
       }
     }

     compress0( p )
     acc.toList
 }
           13 April 2013      Xenonique ©2013                   19
Functions are First Class
• In Scala, functions are first
  class citizens
• Functions can return functions




     13 April 2013   Xenonique ©2013   20
SBT
•   SBT is the de-facto build tool
•   Works with Maven
•   Incremental Compilation +1
•   DSL written in Scala +1
•   Plugins Available +1
•   Complex to Understand -1



        13 April 2013   Xenonique ©2013   21
Gradle
• Gradle is written in Groovy
• Gradle is a DSL too +1
• Easier to Grok +1
• Since v1.4 Gradle support
  incremental compilation through
  Zinc
• Not the de-facto standard -1


     13 April 2013    Xenonique ©2013   22
String Interpolation
•   SIP 12: String interpolation
•   S”Book written by $author”
•   Arbitary identifier: StringContext
•   StringContext(“Books written
    by”).id(author)




        13 April 2013   Xenonique ©2013   23
Value Classes
•   Implicit Classes
•   Classes that extend AnyVal
•   Unboxed value classes
•   Language imports
•   import
    language.implicitConversions



        13 April 2013        Xenonique ©2013   24
Value Classes
Elegant wrappers around simple
types
• A Value class is treated as
  another type
• A value value is assigned to an
  array
• Doing runtime type tests, such as
  pattern matching

     13 April 2013        Xenonique ©2013   25
Incremental Compilation
• Incremental compilation, Zinc
• Language with simple means to do
  interesting things




     13 April 2013   Xenonique ©2013   26
Scala Test
•   The de-facto testing framework
•   Created Bill Venners, JVM Book
•   DSL unit testing language
•   Behaviour Driven Development +1
•   Test Driven Development




        13 April 2013      Xenonique ©2013   27
Play Framework
                Non Java EE web framework




13 April 2013            Xenonique ©2013    28
Play Framework 2.0
•   Non Java EE – No Servlet
•   Built for Web Development
•   Direct manipulation of HTTP
•   Asynchronous Input and Output
•   Scalable Vertically




                                    29
Play Framework Architecture

                                 Web Client


                                  Network


                   Netty (Java NIO Client Server Framework)



                              Play Framework




   13 April 2013                 Xenonique ©2013              30
Play Advantages
•   Highly productive web development
•   Work with Web Designers
•   Feels of “Rails”
•   Compiler type checked
•   Model, View and Controller




                                        31
Play Disadvantages
• Completed encapsulated environment
• Unlike JavaEE and WAR file
  deployment to application server
• No WAR file (yet) as of Play 2.1.x
• Ironically, WAR files need JavaEE
  7 (WebSocket and Async Servlet
  3.1)


                                   32
Play Style
• Dispatch through a Router file
• Directly manipulation of the HTTP
  response, Ok(200), Error(404)
• Control HTTP interface: GET, PUT,
  POST, DELETE
• Model, View and Controller scala
  objects
• Asynchronuous process API
                                      33
Play Persistence
• Play has its own persistence provider
  Anorm: a direct SQL framework
• Play can also use Squeryl: an Object-
  Relational Mapper DSL with type safety.




                                        34
Developer Summary
What You Will Do Tomorrow?

              Why FP?



                          Gradle /
Scala Test   Scala 2.10     SBT


               Play /
               Akka
Game Over

13 April 2013     Xenonique ©2013   37
Professional Services



        Contract Software Development
        Scala, JavaEE, JavaFX, TDD, Gradle

        W: http://www.xenonique.co.uk/blog/
        E: peter.pilgrim@gmail.com



   4/13/2013                                  38
Professional Services



           peter.pilgrim@gmail.com
           Scala, JavaEE 7, JavaFX
           Contracting
           Software Development


   4/13/2013                         39
Attributions
• The author would very like to attribute these
  pleasurable Creative Commons License 3.0
  photographers

•   Brush Metal Elevator door By Jerry "Eyes" Ranch; West Des Moines, IA,
    USA; http://www.flickr.com/photos/ranchjp/3684969194/
•   19/365 Game Over by Mykl Roventine;
    http://www.flickr.com/photos/myklroventine/3210068573
•   Experiment in abstract lightning by Bob Doran; Walnut Creek, Arcata,
    USA ; http://www.flickr.com/photos/humblog/4522984790/in/photostream/




                                                                       40
Attributions #2
•   Study in Math exam photo by Steve S;
    http://www.flickr.com/photos/scubasteveo/296747958/




                                                          41

Weitere ähnliche Inhalte

Ähnlich wie ACCU 2013 Taking Scala into the Enterpise

Trends and future of java
Trends and future of javaTrends and future of java
Trends and future of javaCsaba Toth
 
Angular, the New Angular JS
Angular, the New Angular JSAngular, the New Angular JS
Angular, the New Angular JSKenzan
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfssusercd195b
 
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
 
Cloudfoundry Overview
Cloudfoundry OverviewCloudfoundry Overview
Cloudfoundry Overviewrajdeep
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
Scala for android
Scala for androidScala for android
Scala for androidTack Mobile
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-upTroy Miles
 
Selling Scala to your boss
Selling Scala to your bossSelling Scala to your boss
Selling Scala to your bossJoão Bernardino
 
An Introduction to AngularJS
An Introduction to AngularJSAn Introduction to AngularJS
An Introduction to AngularJSFalk Hartmann
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaJohn Nestor
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure DataTaro L. Saito
 
Cloud stack design camp on jun 15
Cloud stack design camp on jun 15Cloud stack design camp on jun 15
Cloud stack design camp on jun 15Isaac Chiang
 
NetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker TalkNetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker Talkaspyker
 
1java Introduction
1java Introduction1java Introduction
1java IntroductionAdil Jafri
 

Ähnlich wie ACCU 2013 Taking Scala into the Enterpise (20)

Trends and future of java
Trends and future of javaTrends and future of java
Trends and future of java
 
Angular, the New Angular JS
Angular, the New Angular JSAngular, the New Angular JS
Angular, the New Angular JS
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
Functional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdfFunctional Scala 2022 - scalajs Alexis.pdf
Functional Scala 2022 - scalajs Alexis.pdf
 
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
 
Cloudfoundry Overview
Cloudfoundry OverviewCloudfoundry Overview
Cloudfoundry Overview
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Scala for android
Scala for androidScala for android
Scala for android
 
Gradle
GradleGradle
Gradle
 
wotxr-20190320rzr
wotxr-20190320rzrwotxr-20190320rzr
wotxr-20190320rzr
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
 
Selling Scala to your boss
Selling Scala to your bossSelling Scala to your boss
Selling Scala to your boss
 
An Introduction to AngularJS
An Introduction to AngularJSAn Introduction to AngularJS
An Introduction to AngularJS
 
Experience Converting from Ruby to Scala
Experience Converting from Ruby to ScalaExperience Converting from Ruby to Scala
Experience Converting from Ruby to Scala
 
Scala at Treasure Data
Scala at Treasure DataScala at Treasure Data
Scala at Treasure Data
 
Cloud stack design camp on jun 15
Cloud stack design camp on jun 15Cloud stack design camp on jun 15
Cloud stack design camp on jun 15
 
NetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker TalkNetflixOSS and ZeroToDocker Talk
NetflixOSS and ZeroToDocker Talk
 
1java Introduction
1java Introduction1java Introduction
1java Introduction
 
Sap java
Sap javaSap java
Sap java
 
Stackato v4
Stackato v4Stackato v4
Stackato v4
 

Mehr von Peter Pilgrim

Devoxx 2019 - Why we pair?
Devoxx 2019 - Why we pair?Devoxx 2019 - Why we pair?
Devoxx 2019 - Why we pair?Peter Pilgrim
 
Cloud native java are we there yet go tech world 2019
Cloud native java   are we there yet  go tech world 2019Cloud native java   are we there yet  go tech world 2019
Cloud native java are we there yet go tech world 2019Peter Pilgrim
 
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!Peter Pilgrim
 
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017Peter Pilgrim
 
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...Peter Pilgrim
 
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and NoteworthyJava EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and NoteworthyPeter Pilgrim
 
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
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformPeter 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
 
JavaCro 2014 Digital Development with Java EE and Java Platform
JavaCro 2014 Digital Development with Java EE and Java PlatformJavaCro 2014 Digital Development with Java EE and Java Platform
JavaCro 2014 Digital Development with Java EE and Java PlatformPeter Pilgrim
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Peter Pilgrim
 
JavaOne 2011 Progressive JavaFX 2.0 Custom Components
JavaOne 2011 Progressive JavaFX 2.0 Custom ComponentsJavaOne 2011 Progressive JavaFX 2.0 Custom Components
JavaOne 2011 Progressive JavaFX 2.0 Custom ComponentsPeter Pilgrim
 
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
ACCU 2011 Introduction to Scala: An Object Functional Programming LanguageACCU 2011 Introduction to Scala: An Object Functional Programming Language
ACCU 2011 Introduction to Scala: An Object Functional Programming LanguagePeter Pilgrim
 

Mehr von Peter Pilgrim (13)

Devoxx 2019 - Why we pair?
Devoxx 2019 - Why we pair?Devoxx 2019 - Why we pair?
Devoxx 2019 - Why we pair?
 
Cloud native java are we there yet go tech world 2019
Cloud native java   are we there yet  go tech world 2019Cloud native java   are we there yet  go tech world 2019
Cloud native java are we there yet go tech world 2019
 
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
LJC 2018 - PEAT UK - Java EE - Ah, ah, ah! Staying Alive!
 
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
CON6148 - You Are Not Cut Out To Be A Java Contractor - JavaOne 2017
 
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
JavaOne 2015 CON5211 Digital Java EE 7 with JSF Conversations, Flows, and CDI...
 
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and NoteworthyJava EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
Java EE & Glass Fish User Group: Digital JavaEE 7 - New and Noteworthy
 
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
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java Platform
 
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
 
JavaCro 2014 Digital Development with Java EE and Java Platform
JavaCro 2014 Digital Development with Java EE and Java PlatformJavaCro 2014 Digital Development with Java EE and Java Platform
JavaCro 2014 Digital Development with Java EE and Java Platform
 
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
 
JavaOne 2011 Progressive JavaFX 2.0 Custom Components
JavaOne 2011 Progressive JavaFX 2.0 Custom ComponentsJavaOne 2011 Progressive JavaFX 2.0 Custom Components
JavaOne 2011 Progressive JavaFX 2.0 Custom Components
 
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
ACCU 2011 Introduction to Scala: An Object Functional Programming LanguageACCU 2011 Introduction to Scala: An Object Functional Programming Language
ACCU 2011 Introduction to Scala: An Object Functional Programming Language
 

Kürzlich hochgeladen

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 

Kürzlich hochgeladen (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 

ACCU 2013 Taking Scala into the Enterpise

  • 1. Taking Scala into the Enterprise Peter Pilgrim Oracle Java Champion ACCU Conference 2013
  • 2. About the Speaker • Java Champion • Independent Contractor • Java since 1998 • Scala since 2010 13 April 2013 Xenonique ©2013 2
  • 3. Agenda • What’s New in Scala 2.10? • Play Framework • AKKA Framework 13 April 2013 Xenonique ©2013 3
  • 4. TypeSafe 13 April 2013 Xenonique ©2013 4
  • 5. Simplicity “I want a language with simple means to do interesting things, which is not the same as a language to do only simple things.” Prof. Martin Odersky 13 April 2013 Xenonique ©2013 5
  • 6. TypeSafe: The Company • Founded in Summer 2011 • Based in Switzerland and headquartered in New York, USA • Scala, Akka and Play Framework • Professional Support for Scala 13 April 2013 Xenonique ©2013 6
  • 7. Growth of Scala Training • Scala Solutions • Dick Wall and Bill Venners, Escalate Solutions • ScalaDays conference in London 2012 • Scala content at JavaOne 2012 13 April 2013 Xenonique ©2013 7
  • 8. Scala Knowledge • Hunger for more know-how • Growing Awareness in Functional Programming • Object Oriented Languages embrace FP principles • JDK 8 Lambdas • Clojure jobs at CitiBank, London & NY 13 April 2013 Xenonique ©2013 8
  • 9. Scala in Enterprise • Morgan Stanley • HSBC • Guardian UK • Twitter • Linked-In • Four Square 13 April 2013 Xenonique ©2013 9
  • 10. Scala Revision Demonstration of the simplicity 13 April 2013 Xenonique ©2013 10
  • 11. Scalable Language Still has a very bright future Functional Purely Object-Oriented Statically-typed JVM Language 4/13/2013 XeNoNiQUe.co.uk (c) 2011 11
  • 12. Typing Derived from “Pascal” Tree of Computer Language <variableName> [: [ <Type> ] personName: String taxRate: Float density: Double found: False persion: Person 13 April 2013 Xenonique ©2013 12
  • 13. Variables and Values • Assignment less programming • Prefer val over var var x = 10.0; x = 10 + x val y = 10.0 val z: Float = x var t: Int = 42; t = t * 2 13
  • 14. Scala Class class Person ( val firstName: String val lastName: String, val height: Float, val age: Int ) { // Write your definition here } 13 April 2013 Xenonique ©2013 14
  • 15. Instances of Scala Classes val p1 = new Person( "Billy", "Mitchell", 5.10F, 42 ) val p2 = new Person( "Kat", "Moon", 5.8F, 39 ) 13 April 2013 Xenonique ©2013 15
  • 16. Companion Objects object Person { private records = List[Person]() def apply(fn: String, ln: String, h: Float, a: Int): Person = { val p = new Person(fn, ln, h, a ); records = p :: records.reverse // O(1) return p } def recordCount() = records.size } 13 April 2013 Xenonique ©2013 16
  • 17. Case Classes class Transmission( driveTrain: String ) 13 April 2013 Xenonique ©2013 17
  • 18. Scala Functions val isEven: (Int => Boolean) = (k: Int) => k % 2 == 0 • Functions are values, values are object • Ergo, functions are objects in Scala 13 April 2013 Xenonique ©2013 18
  • 19. Scala Code def uniqueSorted[Symbol]( p: List[Symbol] ): List[Symbol] = { val myOrdering = Ordering.fromLessThan[Symbol]( _.toString < _.toString ) var acc = SortedSet.empty(myOrdering) def compress0( q: List[Symbol] ): Unit = { q match { case Nil => Nil case x :: xs => { acc += x ; compress0(xs) } } } compress0( p ) acc.toList } 13 April 2013 Xenonique ©2013 19
  • 20. Functions are First Class • In Scala, functions are first class citizens • Functions can return functions 13 April 2013 Xenonique ©2013 20
  • 21. SBT • SBT is the de-facto build tool • Works with Maven • Incremental Compilation +1 • DSL written in Scala +1 • Plugins Available +1 • Complex to Understand -1 13 April 2013 Xenonique ©2013 21
  • 22. Gradle • Gradle is written in Groovy • Gradle is a DSL too +1 • Easier to Grok +1 • Since v1.4 Gradle support incremental compilation through Zinc • Not the de-facto standard -1 13 April 2013 Xenonique ©2013 22
  • 23. String Interpolation • SIP 12: String interpolation • S”Book written by $author” • Arbitary identifier: StringContext • StringContext(“Books written by”).id(author) 13 April 2013 Xenonique ©2013 23
  • 24. Value Classes • Implicit Classes • Classes that extend AnyVal • Unboxed value classes • Language imports • import language.implicitConversions 13 April 2013 Xenonique ©2013 24
  • 25. Value Classes Elegant wrappers around simple types • A Value class is treated as another type • A value value is assigned to an array • Doing runtime type tests, such as pattern matching 13 April 2013 Xenonique ©2013 25
  • 26. Incremental Compilation • Incremental compilation, Zinc • Language with simple means to do interesting things 13 April 2013 Xenonique ©2013 26
  • 27. Scala Test • The de-facto testing framework • Created Bill Venners, JVM Book • DSL unit testing language • Behaviour Driven Development +1 • Test Driven Development 13 April 2013 Xenonique ©2013 27
  • 28. Play Framework Non Java EE web framework 13 April 2013 Xenonique ©2013 28
  • 29. Play Framework 2.0 • Non Java EE – No Servlet • Built for Web Development • Direct manipulation of HTTP • Asynchronous Input and Output • Scalable Vertically 29
  • 30. Play Framework Architecture Web Client Network Netty (Java NIO Client Server Framework) Play Framework 13 April 2013 Xenonique ©2013 30
  • 31. Play Advantages • Highly productive web development • Work with Web Designers • Feels of “Rails” • Compiler type checked • Model, View and Controller 31
  • 32. Play Disadvantages • Completed encapsulated environment • Unlike JavaEE and WAR file deployment to application server • No WAR file (yet) as of Play 2.1.x • Ironically, WAR files need JavaEE 7 (WebSocket and Async Servlet 3.1) 32
  • 33. Play Style • Dispatch through a Router file • Directly manipulation of the HTTP response, Ok(200), Error(404) • Control HTTP interface: GET, PUT, POST, DELETE • Model, View and Controller scala objects • Asynchronuous process API 33
  • 34. Play Persistence • Play has its own persistence provider Anorm: a direct SQL framework • Play can also use Squeryl: an Object- Relational Mapper DSL with type safety. 34
  • 36. What You Will Do Tomorrow? Why FP? Gradle / Scala Test Scala 2.10 SBT Play / Akka
  • 37. Game Over 13 April 2013 Xenonique ©2013 37
  • 38. Professional Services Contract Software Development Scala, JavaEE, JavaFX, TDD, Gradle W: http://www.xenonique.co.uk/blog/ E: peter.pilgrim@gmail.com 4/13/2013 38
  • 39. Professional Services peter.pilgrim@gmail.com Scala, JavaEE 7, JavaFX Contracting Software Development 4/13/2013 39
  • 40. Attributions • The author would very like to attribute these pleasurable Creative Commons License 3.0 photographers • Brush Metal Elevator door By Jerry "Eyes" Ranch; West Des Moines, IA, USA; http://www.flickr.com/photos/ranchjp/3684969194/ • 19/365 Game Over by Mykl Roventine; http://www.flickr.com/photos/myklroventine/3210068573 • Experiment in abstract lightning by Bob Doran; Walnut Creek, Arcata, USA ; http://www.flickr.com/photos/humblog/4522984790/in/photostream/ 40
  • 41. Attributions #2 • Study in Math exam photo by Steve S; http://www.flickr.com/photos/scubasteveo/296747958/ 41