SlideShare a Scribd company logo
Scala

         Lightning Talk
            @JSUG


Future Languages for the Java VM


      Michael Greifeneder
Overview
    Mix of functional and OO programming
●



    Static typing (performance)
●



    FP: Pattern matching, High order functions,
●


    Parametric Polymorphism, Operator
    overloading
    Closures
●



    Open Source
●



    Functions are objects
●



    Perfect for domain specific languages
●
Vorteile
    Scala ist kompatibel mit Java.
●


        Alle Bibliotheken können weiterverwendet
    –
        werden.
    Scala skaliert
●


        Sprache kann fuer hohere Abstraktionsebenen
    –
        angepasst werden. zB Actors!
    Kann als Scripting Sprache verwendet
●


    werden
    Kurzer Code, aussagekraeftig
●
abstract class SomethingWithName(name:String) {
●

      override def toString():String = name
      def does(what:(SomethingWithName)=>unit) {
         what(this);}}
    case class Person(name:String) extends
    SomethingWithName(name:String) {
      def says(msg: String) = {
        print(name + quot; says quot; + msg)}
      def apply(name:String):Person = new Person(name)}
    case class Stone(name:String) extends
    SomethingWithName (name:String) {
      def apply(name:String):Bagger = new Bagger(name)}
    def swimming(who:SomethingWithName) = who match {
      case Person(name)=>print(quot;Swims in pool: quot; + name)
      case Stone(name)=>print(quot;On the ground: quot; + name)
    var Tom = Person(quot;Tomquot;)
●

    var YellowStone = Stone(quot;YellowStonequot;)
    Tom says quot;Helloquot;
    Tom does swimming //Tom.does(swimming)
                                                Code
    YellowStone does swimming;
Output
    >scala dsl.scala
●


    Tom says Hello
●


    Swimming in pool: Tom
●


    On the ground: YellowBagger
●
Skriptsprache !?
    Folge von Statements
●


    Zugriff auf Kommandozeilenargumente
●


    println(quot;Hello quot; + args(0) + quot;!quot;)
    Ausführen
●


    scala test.scala
    Shellscript
●


        #!/bin/sh
    –
        exec scala quot;$0quot; quot;$@quot;
        !#
        println(quot;Hello, quot; + args(0) + quot;!quot;)
Closures
    Tom does ((in:SomethingWithName) =>
●

    { print(quot;Who needs closures? Maybe quot; +
    in + quot;?quot;) })
    Output:
●


        Who needs closures? Maybe Tom?
    –

    Auch nett:
●


        args.foreach(arg => println(arg))
    –

    Noch kürzer
●


        args.forach(println)
    –
XML Processing
Syntax Sugar
Functional Style
Ease of Use
    Maps
●


        val map = Map(
    –
        “Austria”->”Vienna”,
        “Germany”->”Berlin”,
        “Switzerland” -> “Bern”)
        map(“Austria”
    List
●


        val list = List(1,2,3)
    –
        val list2 = 1 ::: 2 ::: 3 ::: Nil
Short Code
    Keine Strichpunkt notwendig.
●



    Keine geschwungenen Klammern notwendig
●


    bei einem Ausdruck
        def method = x
    –

    First class functions
●


        args.foreach(println)
    –

●
Matching Expressions
    val friend = args(0) match {
●


      case quot;saltquot; => quot;pepperquot;
      case quot;chipsquot; => quot;salsaquot;
      case quot;eggsquot; => quot;baconquot;
      case _ => quot;huh?quot;
    }
    Keine Breaks notwendig
●



    Match kann auch Ergebnis liefern
●
Catching Exceptions
    try {
●


      doSomething()
    } catch {
      case ex: IOException =>
                 println(quot;Oops!quot;)
      case ex: NullPointerException =>
                 println(quot;Oops!!quot;)
    }
Actors! (And Action!)
    object PrintActor extends Actor{
●


      def act() = {
        var num = 0;
        react{
          case msg:String =>
                       println(num + msg)
          case c:Int => num+=c
        }
      }
    }
    Tester.start(); Tester ! 2
    Tester ! “First Message”;

More Related Content

What's hot

Os Practical Assignment 1
Os Practical Assignment 1Os Practical Assignment 1
Os Practical Assignment 1
Emmanuel Garcia
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik kata
haqiemisme
 
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
festival ICT 2016
 
Ugly code
Ugly codeUgly code
Ugly code
Odd-e
 

What's hot (18)

Closures for Java
Closures for JavaClosures for Java
Closures for Java
 
Yg byev2e
Yg byev2eYg byev2e
Yg byev2e
 
Os Practical Assignment 1
Os Practical Assignment 1Os Practical Assignment 1
Os Practical Assignment 1
 
RabbitMQ for Perl mongers
RabbitMQ for Perl mongersRabbitMQ for Perl mongers
RabbitMQ for Perl mongers
 
Using the Command Line with Magento
Using the Command Line with MagentoUsing the Command Line with Magento
Using the Command Line with Magento
 
Instalación de emu8086 y compilados
Instalación de emu8086 y compiladosInstalación de emu8086 y compilados
Instalación de emu8086 y compilados
 
cpanfileがRubyでパースできることに気づいた俺たちは
cpanfileがRubyでパースできることに気づいた俺たちはcpanfileがRubyでパースできることに気づいた俺たちは
cpanfileがRubyでパースできることに気づいた俺たちは
 
Program membalik kata
Program membalik kataProgram membalik kata
Program membalik kata
 
Cloud Erlang
Cloud ErlangCloud Erlang
Cloud Erlang
 
Coffee script
Coffee scriptCoffee script
Coffee script
 
c++ program for Canteen management
c++ program for Canteen managementc++ program for Canteen management
c++ program for Canteen management
 
Taking Inspiration From The Functional World
Taking Inspiration From The Functional WorldTaking Inspiration From The Functional World
Taking Inspiration From The Functional World
 
Source Code
Source CodeSource Code
Source Code
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
festival ICT 2013: Solid as diamond: use ruby in an web application penetrati...
 
timingExercise
timingExercisetimingExercise
timingExercise
 
Ugly code
Ugly codeUgly code
Ugly code
 
DESTRUCTOR EXAMPLES
DESTRUCTOR EXAMPLESDESTRUCTOR EXAMPLES
DESTRUCTOR EXAMPLES
 

Similar to JSUG - Scala Lightning Talk by Michael Greifeneder

Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In Perl
Kang-min Liu
 
Ruby 程式語言簡介
Ruby 程式語言簡介Ruby 程式語言簡介
Ruby 程式語言簡介
Wen-Tien Chang
 
Rubish- A Quixotic Shell
Rubish- A Quixotic ShellRubish- A Quixotic Shell
Rubish- A Quixotic Shell
guest3464d2
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
Loïc Descotte
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
Sway Wang
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
oscon2007
 

Similar to JSUG - Scala Lightning Talk by Michael Greifeneder (20)

Good Evils In Perl
Good Evils In PerlGood Evils In Perl
Good Evils In Perl
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Ruby 程式語言簡介
Ruby 程式語言簡介Ruby 程式語言簡介
Ruby 程式語言簡介
 
Rubish- A Quixotic Shell
Rubish- A Quixotic ShellRubish- A Quixotic Shell
Rubish- A Quixotic Shell
 
Erlang with Regexp Perl And Port
Erlang with Regexp Perl And PortErlang with Regexp Perl And Port
Erlang with Regexp Perl And Port
 
Impacta - Show Day de Rails
Impacta - Show Day de RailsImpacta - Show Day de Rails
Impacta - Show Day de Rails
 
Scala 3camp 2011
Scala   3camp 2011Scala   3camp 2011
Scala 3camp 2011
 
Groovy
GroovyGroovy
Groovy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Why Scala?
Why Scala?Why Scala?
Why Scala?
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
 
Modern Perl
Modern PerlModern Perl
Modern Perl
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Oscon 2010 Specs talk
Oscon 2010 Specs talkOscon 2010 Specs talk
Oscon 2010 Specs talk
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
My First Rails Plugin - Usertext
My First Rails Plugin - UsertextMy First Rails Plugin - Usertext
My First Rails Plugin - Usertext
 
Os Fetterupdated
Os FetterupdatedOs Fetterupdated
Os Fetterupdated
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 

More from Christoph Pickl

More from Christoph Pickl (20)

JSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph PicklJSUG - AS3 vs Java by Christoph Pickl
JSUG - AS3 vs Java by Christoph Pickl
 
JSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir classJSUG - Layouting TeX documents with the Memoir class
JSUG - Layouting TeX documents with the Memoir class
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
 
JSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph PicklJSUG - ActionScript 3 vs Java by Christoph Pickl
JSUG - ActionScript 3 vs Java by Christoph Pickl
 
JSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert PreiningJSUG - TeX, LaTeX und der Rest by Norbert Preining
JSUG - TeX, LaTeX und der Rest by Norbert Preining
 
JSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph PicklJSUG - TeX Day by Christoph Pickl
JSUG - TeX Day by Christoph Pickl
 
JSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph PicklJSUG - The Sound of Shopping by Christoph Pickl
JSUG - The Sound of Shopping by Christoph Pickl
 
JSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin SchuerrerJSUG - Tim aka EPROG2 by Martin Schuerrer
JSUG - Tim aka EPROG2 by Martin Schuerrer
 
JSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas HubmerJSUG - Java Service Enabler by Andreas Hubmer
JSUG - Java Service Enabler by Andreas Hubmer
 
JSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar PetrovJSUG - Hoppla by Florian Motlik and Petar Petrov
JSUG - Hoppla by Florian Motlik and Petar Petrov
 
JSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans SowaJSUG - Google Web Toolkit by Hans Sowa
JSUG - Google Web Toolkit by Hans Sowa
 
JSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas PieberJSUG - TU Wien Cocoon Project by Andreas Pieber
JSUG - TU Wien Cocoon Project by Andreas Pieber
 
JSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas LangJSUG - TU Wien Castor Project by Lukas Lang
JSUG - TU Wien Castor Project by Lukas Lang
 
JSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph PicklJSUG - LaTeX Introduction by Christoph Pickl
JSUG - LaTeX Introduction by Christoph Pickl
 
JSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederJSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael Greifeneder
 
JSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph PicklJSUG - Filthy Flex by Christoph Pickl
JSUG - Filthy Flex by Christoph Pickl
 
JSUG - Seam by Florian Motlik
JSUG - Seam by Florian MotlikJSUG - Seam by Florian Motlik
JSUG - Seam by Florian Motlik
 
JSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan ZarnikovJSUG - Google Guice by Jan Zarnikov
JSUG - Google Guice by Jan Zarnikov
 
JSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph PicklJSUG - Java FX by Christoph Pickl
JSUG - Java FX by Christoph Pickl
 
JSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph PicklJSUG - Tech Tips1 by Christoph Pickl
JSUG - Tech Tips1 by Christoph Pickl
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 

JSUG - Scala Lightning Talk by Michael Greifeneder

  • 1. Scala Lightning Talk @JSUG Future Languages for the Java VM Michael Greifeneder
  • 2. Overview Mix of functional and OO programming ● Static typing (performance) ● FP: Pattern matching, High order functions, ● Parametric Polymorphism, Operator overloading Closures ● Open Source ● Functions are objects ● Perfect for domain specific languages ●
  • 3. Vorteile Scala ist kompatibel mit Java. ● Alle Bibliotheken können weiterverwendet – werden. Scala skaliert ● Sprache kann fuer hohere Abstraktionsebenen – angepasst werden. zB Actors! Kann als Scripting Sprache verwendet ● werden Kurzer Code, aussagekraeftig ●
  • 4. abstract class SomethingWithName(name:String) { ● override def toString():String = name def does(what:(SomethingWithName)=>unit) { what(this);}} case class Person(name:String) extends SomethingWithName(name:String) { def says(msg: String) = { print(name + quot; says quot; + msg)} def apply(name:String):Person = new Person(name)} case class Stone(name:String) extends SomethingWithName (name:String) { def apply(name:String):Bagger = new Bagger(name)} def swimming(who:SomethingWithName) = who match { case Person(name)=>print(quot;Swims in pool: quot; + name) case Stone(name)=>print(quot;On the ground: quot; + name) var Tom = Person(quot;Tomquot;) ● var YellowStone = Stone(quot;YellowStonequot;) Tom says quot;Helloquot; Tom does swimming //Tom.does(swimming) Code YellowStone does swimming;
  • 5. Output >scala dsl.scala ● Tom says Hello ● Swimming in pool: Tom ● On the ground: YellowBagger ●
  • 6. Skriptsprache !? Folge von Statements ● Zugriff auf Kommandozeilenargumente ● println(quot;Hello quot; + args(0) + quot;!quot;) Ausführen ● scala test.scala Shellscript ● #!/bin/sh – exec scala quot;$0quot; quot;$@quot; !# println(quot;Hello, quot; + args(0) + quot;!quot;)
  • 7. Closures Tom does ((in:SomethingWithName) => ● { print(quot;Who needs closures? Maybe quot; + in + quot;?quot;) }) Output: ● Who needs closures? Maybe Tom? – Auch nett: ● args.foreach(arg => println(arg)) – Noch kürzer ● args.forach(println) –
  • 11. Ease of Use Maps ● val map = Map( – “Austria”->”Vienna”, “Germany”->”Berlin”, “Switzerland” -> “Bern”) map(“Austria” List ● val list = List(1,2,3) – val list2 = 1 ::: 2 ::: 3 ::: Nil
  • 12. Short Code Keine Strichpunkt notwendig. ● Keine geschwungenen Klammern notwendig ● bei einem Ausdruck def method = x – First class functions ● args.foreach(println) – ●
  • 13. Matching Expressions val friend = args(0) match { ● case quot;saltquot; => quot;pepperquot; case quot;chipsquot; => quot;salsaquot; case quot;eggsquot; => quot;baconquot; case _ => quot;huh?quot; } Keine Breaks notwendig ● Match kann auch Ergebnis liefern ●
  • 14. Catching Exceptions try { ● doSomething() } catch { case ex: IOException => println(quot;Oops!quot;) case ex: NullPointerException => println(quot;Oops!!quot;) }
  • 15. Actors! (And Action!) object PrintActor extends Actor{ ● def act() = { var num = 0; react{ case msg:String => println(num + msg) case c:Int => num+=c } } } Tester.start(); Tester ! 2 Tester ! “First Message”;