SlideShare a Scribd company logo
1 of 21
Download to read offline
Live Coding                         'the Java of the future’ 	
  
	
  




       Urs Peter
       19:45 uur - Zaal Zand (boven)	
  
Core ingredients of Scala

                       1.7	
  




            Java	
  
Who uses Scala?
Scala Dev environment
Options
          Our first sip of
Classes




 Tuples

                             Traits



               Implicits
Loops




A single ride with many loops
Pattern Matching
The future is bright, the future is fun
                 -ctional
Scala Collections




The beginning of a beautiful friendship
Google Code Jam Exercise
Problem	
  
The	
  aim	
  of	
  this	
  task	
  is	
  to	
  translate	
  a	
  language	
  into	
  a	
  new	
  language	
  called	
  Googlerese.	
  To	
  
translate	
  we	
  take	
  any	
  message	
  and	
  replace	
  each	
  English	
  le<er	
  with	
  another	
  English	
  le<er.	
  
This	
  mapping	
  is	
  one-­‐to-­‐one	
  and	
  onto,	
  which	
  means	
  that	
  the	
  same	
  input	
  le<er	
  always	
  gets	
  
replaced	
  with	
  the	
  same	
  output	
  le<er,	
  and	
  different	
  input	
  le<ers	
  always	
  get	
  replaced	
  with	
  
different	
  output	
  le<ers.	
  A	
  le<er	
  may	
  be	
  replaced	
  by	
  itself.	
  Spaces	
  are	
  leC	
  as-­‐is.	
  
	
  
For	
  example	
  (and	
  here	
  is	
  a	
  hint!),	
  the	
  translaIon	
  algorithm	
  includes	
  the	
  following	
  three	
  
mappings:	
  'a'	
  -­‐>	
  'y',	
  'o'	
  -­‐>	
  'e',	
  and	
  'z'	
  -­‐>	
  'q'.	
  This	
  means	
  that	
  "a	
  zoo"	
  will	
  become	
  "y	
  qee".	
  	
  
	
  
Sample	
  Input/Output	
  
Input:	
   	
  Case	
  #1:	
  ejp mysljylc kd kxveddknmc re jsicpdrysi

               	
  Case	
  #2:	
  rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd

               	
  Case	
  #3:	
  de kr kd eoya kw aej tysr re ujdr lkgc jv"
	
  
Output: 	
  Case	
  #1:	
  our language is impossible to understand

               	
  Case	
  #2:	
  there are twenty six factorial possibilities

               	
  Case	
  #3:	
  so it is okay if you want to just give up"
	
  
Lets go parallel
(Back to)
The future of Java
Java8 will have Lambda Expressions   	
  
 Java
   root.listFiles((File f) -> f.isDirectory());"
   "
   //even with type inference"
   root.listFiles(f -> f.isDirectory());"
   "
   //... and shorthand notation"
   root.listFiles(File::isDirectory);"
   "
   "
   "
 Scala	
  
   root.listFiles(f:File => f.isDirectory)"
   "
   root.listFiles(f => f.isDirectory)"
   "
   root.listFiles(_.isDirectory)"
Java8 will have internal iteration with Lambda expressions	
  
 Java
   double highestScore ="
         " students.filter(Student s -> s.getGradYear() == 2011)"
         "       " .map(Student s -> s.getScore())"
         "       " .max();"
   "
   "



 Scala	
  
   val highestScore = "
         "studens.filter(s:Student => s.gradYear == 2011)"
         "       ".map(s:Student => s.score)"
         "       ".max"
Java8 will have default implementations for interfaces
(virtual extension methods)  	
  
    Java
     "
"    "
"    interface List<T> … {"
           "// existing methods, plus"
           "void sort(Comparator<? super T> cmp) "default { "
           "       "Collections.sort(this, cmp); }"
           "}"
     //however: no fields, no self types, "
     //... And therefore ‘no multiple inheritance without the issues’"



    Scala	
  
     Traits ..."
     //with fields, self types"
     //... And therefore: ‘multiple inheritance without the issues’"
Java8 will have support for parallel Collections	
  
    Java
     "
"
     Set<Album> favs ="
"       albums.parallel()"
           " .filter(a -> a.tracks.anyMatch(t -> (t.rating >= 4)))"
           " .into(new ConcurrentHashSet<>());"



    Scala	
  
     val favs = "
        albums.par!
              .filter(a => a.tracks.exists(t => t.rating >= 4)"
              .toSet"
              "
Delivery date 	
  
Java8
"
"         2013 !
          in JDK 8!


Scala	
  

      "
      "
          since 2010 !
          in JDK 1.5, 1.6, 1.7       !
       "
      With an impressive track record of many mission
      critical applications by now ..."
My Advice:




    and	
  enjoy:	
  
def ask(question: Any) = question match {!
    case "?"   => "answer for ?"!
    case "???" => "answer for ???"!
    case _     => "42"!
 }"
Code samples can be found at:"
"
https://github.com/upeter/Java8vsScalaCodeSamples.git"
"
All rights reserved."
"

More Related Content

What's hot

Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to ScalaTim Underwood
 
Macros and reflection in scala 2.10
Macros and reflection in scala 2.10Macros and reflection in scala 2.10
Macros and reflection in scala 2.10Johan Andrén
 
Gatling - Paris Perf User Group
Gatling - Paris Perf User GroupGatling - Paris Perf User Group
Gatling - Paris Perf User Groupslandelle
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java DevelopersMichael Galpin
 
Scala for the doubters. Максим Клыга
Scala for the doubters. Максим КлыгаScala for the doubters. Максим Клыга
Scala for the doubters. Максим КлыгаAlina Dolgikh
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To ScalaPeter Maas
 
Introduction to Scala : Clueda
Introduction to Scala : CluedaIntroduction to Scala : Clueda
Introduction to Scala : CluedaAndreas Neumann
 
Scala In The Wild
Scala In The WildScala In The Wild
Scala In The Wilddjspiewak
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaOstap Andrusiv
 
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
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scalafanf42
 
Intro to scala
Intro to scalaIntro to scala
Intro to scalaJoe Zulli
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scalatod esking
 
Practically Functional
Practically FunctionalPractically Functional
Practically Functionaldjspiewak
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash courseHolden Karau
 
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)jaxLondonConference
 

What's hot (20)

Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
A Brief Intro to Scala
A Brief Intro to ScalaA Brief Intro to Scala
A Brief Intro to Scala
 
Macros and reflection in scala 2.10
Macros and reflection in scala 2.10Macros and reflection in scala 2.10
Macros and reflection in scala 2.10
 
Gatling - Paris Perf User Group
Gatling - Paris Perf User GroupGatling - Paris Perf User Group
Gatling - Paris Perf User Group
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
Scala for the doubters. Максим Клыга
Scala for the doubters. Максим КлыгаScala for the doubters. Максим Клыга
Scala for the doubters. Максим Клыга
 
Introduction To Scala
Introduction To ScalaIntroduction To Scala
Introduction To Scala
 
Scala Intro
Scala IntroScala Intro
Scala Intro
 
Introduction to Scala : Clueda
Introduction to Scala : CluedaIntroduction to Scala : Clueda
Introduction to Scala : Clueda
 
Scala In The Wild
Scala In The WildScala In The Wild
Scala In The Wild
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with Scala
 
Scala on Android
Scala on AndroidScala on Android
Scala on Android
 
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)
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Intro to scala
Intro to scalaIntro to scala
Intro to scala
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scala
 
Practically Functional
Practically FunctionalPractically Functional
Practically Functional
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash course
 
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
 

Similar to Live coding scala 'the java of the future'

Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvmIsaias Barroso
 
Scala overview
Scala overviewScala overview
Scala overviewSteve Min
 
Scala for the doubters
Scala for the doubtersScala for the doubters
Scala for the doubtersMax Klyga
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaDerek Chen-Becker
 
Scala elegant and exotic part 1
Scala  elegant and exotic part 1Scala  elegant and exotic part 1
Scala elegant and exotic part 1VulcanMinds
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinayViplav Jain
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Mario Camou Riveroll
 
Introduction to Scala language
Introduction to Scala languageIntroduction to Scala language
Introduction to Scala languageAaqib Pervaiz
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San FranciscoMartin Odersky
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaWO Community
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-partsFuqiang Wang
 
Scala intro for Java devs 20150324
Scala intro for Java devs 20150324Scala intro for Java devs 20150324
Scala intro for Java devs 20150324Erik Schmiegelow
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistpmanvi
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scalamasahitojp
 

Similar to Live coding scala 'the java of the future' (20)

Scala
ScalaScala
Scala
 
Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvm
 
Scala overview
Scala overviewScala overview
Scala overview
 
Scala for the doubters
Scala for the doubtersScala for the doubters
Scala for the doubters
 
Stepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to ScalaStepping Up : A Brief Intro to Scala
Stepping Up : A Brief Intro to Scala
 
Scala elegant and exotic part 1
Scala  elegant and exotic part 1Scala  elegant and exotic part 1
Scala elegant and exotic part 1
 
Workshop Scala
Workshop ScalaWorkshop Scala
Workshop Scala
 
Scala final ppt vinay
Scala final ppt vinayScala final ppt vinay
Scala final ppt vinay
 
Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?Static or Dynamic Typing? Why not both?
Static or Dynamic Typing? Why not both?
 
Introduction to Scala language
Introduction to Scala languageIntroduction to Scala language
Introduction to Scala language
 
Scala Days San Francisco
Scala Days San FranciscoScala Days San Francisco
Scala Days San Francisco
 
Quick introduction to scala
Quick introduction to scalaQuick introduction to scala
Quick introduction to scala
 
Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
 
All about scala
All about scalaAll about scala
All about scala
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Scala the-good-parts
Scala the-good-partsScala the-good-parts
Scala the-good-parts
 
Scala intro for Java devs 20150324
Scala intro for Java devs 20150324Scala intro for Java devs 20150324
Scala intro for Java devs 20150324
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologist
 
5分で説明する Play! scala
5分で説明する Play! scala5分で説明する Play! scala
5分で説明する Play! scala
 
Devoxx
DevoxxDevoxx
Devoxx
 

More from Xebia Nederland BV

The 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationThe 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationXebia Nederland BV
 
Holacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartHolacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartXebia Nederland BV
 
Videoscribe je agile transitie
Videoscribe je agile transitieVideoscribe je agile transitie
Videoscribe je agile transitieXebia Nederland BV
 
Sketchnote je Product Backlog Items & Sprint Retrospectives
Sketchnote je Product Backlog Items & Sprint RetrospectivesSketchnote je Product Backlog Items & Sprint Retrospectives
Sketchnote je Product Backlog Items & Sprint RetrospectivesXebia Nederland BV
 
Why we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionWhy we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionXebia Nederland BV
 
Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryXebia Nederland BV
 
Becoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientBecoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientXebia Nederland BV
 
How DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingHow DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingXebia Nederland BV
 
Become a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaBecome a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaXebia Nederland BV
 
Building a Docker powered feature driven delivery pipeline at hoyhoy.nl
Building a Docker powered feature driven delivery pipeline at hoyhoy.nlBuilding a Docker powered feature driven delivery pipeline at hoyhoy.nl
Building a Docker powered feature driven delivery pipeline at hoyhoy.nlXebia Nederland BV
 
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...TestWorks Conf The magic of models for 1000% test automation - Machiel van de...
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...Xebia Nederland BV
 
TestWorks Conf Serenity BDD in action - John Ferguson Smart
TestWorks Conf Serenity BDD in action - John Ferguson SmartTestWorks Conf Serenity BDD in action - John Ferguson Smart
TestWorks Conf Serenity BDD in action - John Ferguson SmartXebia Nederland BV
 
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarTestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarXebia Nederland BV
 

More from Xebia Nederland BV (20)

The 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationThe 10 tip recipe for business model innovation
The 10 tip recipe for business model innovation
 
Scan je teams!
Scan je teams!Scan je teams!
Scan je teams!
 
Holacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartHolacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taart
 
3* Scrum Master
3* Scrum Master3* Scrum Master
3* Scrum Master
 
Judo Strategy
Judo StrategyJudo Strategy
Judo Strategy
 
Agile en Scrum buiten IT
Agile en Scrum buiten ITAgile en Scrum buiten IT
Agile en Scrum buiten IT
 
Scrumban
ScrumbanScrumban
Scrumban
 
Creating the right products
Creating the right productsCreating the right products
Creating the right products
 
Videoscribe je agile transitie
Videoscribe je agile transitieVideoscribe je agile transitie
Videoscribe je agile transitie
 
Sketchnote je Product Backlog Items & Sprint Retrospectives
Sketchnote je Product Backlog Items & Sprint RetrospectivesSketchnote je Product Backlog Items & Sprint Retrospectives
Sketchnote je Product Backlog Items & Sprint Retrospectives
 
Why we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionWhy we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right question
 
Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous delivery
 
Becoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientBecoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredient
 
How DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingHow DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of Testing
 
Become a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaBecome a digital company - Case KPN / Xebia
Become a digital company - Case KPN / Xebia
 
Building a Docker powered feature driven delivery pipeline at hoyhoy.nl
Building a Docker powered feature driven delivery pipeline at hoyhoy.nlBuilding a Docker powered feature driven delivery pipeline at hoyhoy.nl
Building a Docker powered feature driven delivery pipeline at hoyhoy.nl
 
Webinar Xebia & bol.com
Webinar Xebia & bol.comWebinar Xebia & bol.com
Webinar Xebia & bol.com
 
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...TestWorks Conf The magic of models for 1000% test automation - Machiel van de...
TestWorks Conf The magic of models for 1000% test automation - Machiel van de...
 
TestWorks Conf Serenity BDD in action - John Ferguson Smart
TestWorks Conf Serenity BDD in action - John Ferguson SmartTestWorks Conf Serenity BDD in action - John Ferguson Smart
TestWorks Conf Serenity BDD in action - John Ferguson Smart
 
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarTestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
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 pragmaticsAndrey Dotsenko
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Live coding scala 'the java of the future'

  • 1. Live Coding 'the Java of the future’     Urs Peter 19:45 uur - Zaal Zand (boven)  
  • 2. Core ingredients of Scala 1.7   Java  
  • 5. Options Our first sip of Classes Tuples Traits Implicits
  • 6. Loops A single ride with many loops
  • 7.
  • 9. The future is bright, the future is fun -ctional
  • 10. Scala Collections The beginning of a beautiful friendship
  • 11. Google Code Jam Exercise Problem   The  aim  of  this  task  is  to  translate  a  language  into  a  new  language  called  Googlerese.  To   translate  we  take  any  message  and  replace  each  English  le<er  with  another  English  le<er.   This  mapping  is  one-­‐to-­‐one  and  onto,  which  means  that  the  same  input  le<er  always  gets   replaced  with  the  same  output  le<er,  and  different  input  le<ers  always  get  replaced  with   different  output  le<ers.  A  le<er  may  be  replaced  by  itself.  Spaces  are  leC  as-­‐is.     For  example  (and  here  is  a  hint!),  the  translaIon  algorithm  includes  the  following  three   mappings:  'a'  -­‐>  'y',  'o'  -­‐>  'e',  and  'z'  -­‐>  'q'.  This  means  that  "a  zoo"  will  become  "y  qee".       Sample  Input/Output   Input:    Case  #1:  ejp mysljylc kd kxveddknmc re jsicpdrysi
  Case  #2:  rbcpc ypc rtcsra dkh wyfrepkym veddknkmkrkcd
  Case  #3:  de kr kd eoya kw aej tysr re ujdr lkgc jv"   Output:  Case  #1:  our language is impossible to understand
  Case  #2:  there are twenty six factorial possibilities
  Case  #3:  so it is okay if you want to just give up"  
  • 14. Java8 will have Lambda Expressions   Java root.listFiles((File f) -> f.isDirectory());" " //even with type inference" root.listFiles(f -> f.isDirectory());" " //... and shorthand notation" root.listFiles(File::isDirectory);" " " " Scala   root.listFiles(f:File => f.isDirectory)" " root.listFiles(f => f.isDirectory)" " root.listFiles(_.isDirectory)"
  • 15. Java8 will have internal iteration with Lambda expressions   Java double highestScore =" " students.filter(Student s -> s.getGradYear() == 2011)" " " .map(Student s -> s.getScore())" " " .max();" " " Scala   val highestScore = " "studens.filter(s:Student => s.gradYear == 2011)" " ".map(s:Student => s.score)" " ".max"
  • 16. Java8 will have default implementations for interfaces (virtual extension methods)   Java " " " " interface List<T> … {" "// existing methods, plus" "void sort(Comparator<? super T> cmp) "default { " " "Collections.sort(this, cmp); }" "}" //however: no fields, no self types, " //... And therefore ‘no multiple inheritance without the issues’" Scala   Traits ..." //with fields, self types" //... And therefore: ‘multiple inheritance without the issues’"
  • 17. Java8 will have support for parallel Collections   Java " " Set<Album> favs =" " albums.parallel()" " .filter(a -> a.tracks.anyMatch(t -> (t.rating >= 4)))" " .into(new ConcurrentHashSet<>());" Scala   val favs = " albums.par! .filter(a => a.tracks.exists(t => t.rating >= 4)" .toSet" "
  • 18. Delivery date   Java8 " " 2013 ! in JDK 8! Scala   " " since 2010 ! in JDK 1.5, 1.6, 1.7 ! " With an impressive track record of many mission critical applications by now ..."
  • 19. My Advice: and  enjoy:  
  • 20. def ask(question: Any) = question match {! case "?" => "answer for ?"! case "???" => "answer for ???"! case _ => "42"! }"
  • 21. Code samples can be found at:" " https://github.com/upeter/Java8vsScalaCodeSamples.git" " All rights reserved." "