SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
By : Zvika Markfeld
                                      Tikal Knowledge
                                             Scala TCE




                  Introduction to
               The Scala Language
            Developer Productivity Redefined


15-May-11
Agenda

        Introduction
        Language Features
        Ecosphere
        Q&A




15-May-11                   WWW.TIKALK.COM
Introduction
            History, Motivation, Whos & Whos




15-May-11
What is Scala?

        General purpose, compiled language
        Relatively new (2003)
        Designed to express common programming patterns
            Concisely
            Elegantly
            In a type-safe way
        Originally intended to run on both the JVM and the CLR
            After some time, the .NET implementation fell aside
            Later on, thanks to a grant from Microsoft, work resumed
        Resembles dynamic languages such as Python / Ruby
        Combines OO and functional languages features


15-May-11                                                     WWW.TIKALK.COM
Personal Issues

        Created by Martin Odersky, a computer scientist at EPFL
        in Lausanne, Switzerland.
            Co-designer of Java's generics, and the original author of
            the current javac
        James Gosling:
            "If I needed to choose a language other than Java, it would
            be Scala"
        James Strachan (Groovy creator) has left Groovy and
        now advocates Scala
            "If I had known Scala when I created Groovy, I would have
            probably not created it at all "



15-May-11                                                       WWW.TIKALK.COM
Static Typing

Scala is a statically-typed language, unlike Ruby or Python
      Better IDE assistance
            Code completion
            Refactoring support
            Developer productivity enhanced
      Safer code via compile-time checks
      Better performance
      Enhancing developer productivity
      No need to wait for JSR-292's invokedynamic for performance
      boost
            As in Groovy, JRuby, Jython, …
      Code size is typically reduced by a factor of 2-3 compared to
      Java

15-May-11                                                     WWW.TIKALK.COM
Compatibility

        The Scala compiler generates Java bytecode
            100% compatible with the JRE
            Seamless use Java objects in Scala and vice versa
            Deploy Scala applications to any JEE container / Android
            Reuse existing tools, servers, libraries
            Keep existing knowledge & workers
            Make the change gradually
               Java -> Jala -> Scala




15-May-11                                                     WWW.TIKALK.COM
What Went Wrong with Java?

 Oh, quite a few things:
        Java is over-verbose
        Stopped evolving
        Long adoption of new development idioms
            Functional programming, for instance

        Political / Marketing Issues (ok, Oracle)
        "Learning Java stunts your intellectual growth as a
        developer" [at least, some would say]




15-May-11                                                 WWW.TIKALK.COM
Why Prefer Scala Over Java ?

 Scala corrects many of Java's mistakes:
        Everything is an Object
        Type inference
            var dummy= Map[String,Int]()
        True Mixins, Traits, Duck Typing
        Functional programming language concepts
        Fresh start, no backward compatibility constraints
            Generics, anyone?
        More compact
            No getters, setters, equals(), hashCode(), toString(),...



15-May-11                                                         WWW.TIKALK.COM
...Scala over Java

      Allows using new idioms and ways of programming
            Mostly just too laborious to do in Java
      Less LOC doing the same amount of work
      Better readability
            Never use anonymous inner classes again
      But still, leverage your Java code from Scala
      Productivity benefits
            Looks like a dynamically typed language
            While actually being 100% statically typed




15-May-11                                                WWW.TIKALK.COM
Polyg-wha?

        It is common advice that you should learn multiple
        programming languages
        Scala integrates functional programming with OO
        programming
        Scala allows you to gradually learn functional techniques
        while still being able to use familiar object-oriented
        techniques
            Useful when migrating from Java
            Learning Scala may be easier than learning non-
            OO functional languages




15-May-11                                                     WWW.TIKALK.COM
Functional Concepts in Scala

        Functions are first-class values
        Convenient closure syntax
        Lazy evaluation
        Pattern matching
        Tailcall optimization
        Powerful generics

 (*) Still, Scala feels less functional because its core syntax is largely in the
 tradition of Java, not Lisp, ML, or Haskell, the three most prominent
 ancestors of functional language families)




15-May-11                                                               WWW.TIKALK.COM
Performance

        On par with Java
        Some features of Scala can produce faster code
            Specialization
            Inlining
            Laziness




        ...While other features makes it slower
15-May-11                                         WWW.TIKALK.COM
Language Features
            What's all the fuss about, then?




15-May-11
Higher Order Functions

        Functions are first-class objects
           Can be assigned to variables
           Passed to other functions
           Same as any other data type
        Code made more concise and readable
            ...not quite as concise as in some other functional
            languages
            But much, much better than the equivalent Java code




15-May-11                                                    WWW.TIKALK.COM
Side Effects Problem

     In OO languages, objects may contain state - mutable
     instance data
     When a method uses mutable data, it now has side effects
            Reading or writing any state which is not an incoming or
            outgoing argument
     Functions with side effects
            Are harder to test
            Harder to reason about
            In general harder to get right


     As more side effects are added, they accumulate, making
     the composed function even more difficult to get right

15-May-11                                                        WWW.TIKALK.COM
Immutable Values

        Using immutable values...
            Makes it easier to write code without side effects
            Reduces the likelihood of concurrency bugs
            Can make code easier to read and understand
        Scala separates the concept of a val from a var:
            A val in Scala is like a final variable in Java
            A var is a regular variable
            No "default" mutable - forces you to think about that choice
        Scala also has support for immutable data structures
            When you add to immutable Map/List/Set in Scala, you get
            a new object: Old keys and values are not copied, but
            shared


15-May-11                                                        WWW.TIKALK.COM
Referential Transparency
        The Imperative Way:
            Use variables (mutable data) and loops
        The Functional Way:
            Recursion & higher order functions, without mutable data
        Referentially transparent -> Deterministic
            Calling a function with a specific set of values as
            arguments will always return exactly the same value




15-May-11                                                     WWW.TIKALK.COM
Actor Concurrency
        The Java thread/monitor model works quite well...
            For a small number of threads
            Dealing with a very small number of shared objects




        But a synchronized method isn't referentially transparent!
        Scala supports the Java approach, but it also provides
        another model for better scale-up: the Actor model
            Message-queue mechanism borrowed from Erlang
               A language designed for high concurrency

15-May-11                                                        WWW.TIKALK.COM
Actor Mechanics
        An Actor is responsible for maintaining data shared by
        multiple threads
        Only the Actor is allowed to access that data
        Threads communicate with the Actor by sending
        messages to it
        The Actor can respond by sending messages back
            If the other thread is an Actor
        Typically the messages are immutable
        Each Actor has a message inbox where incoming
        messages are queued
        Scala's Actor library handles the message transfers
            The programmer does not have to deal with synchronization


15-May-11                                                    WWW.TIKALK.COM
Actors Are Way Better

        High-load programs often suffer from:
            Data corruption due to concurrent access.
            Deadlock
            Resource bottleneck or starvation
        Java's monitors alleviates the first problem
        Scala Also takes care of the second




15-May-11                                               WWW.TIKALK.COM
Actor Libraries

        There are 6-7 libraries in Java that implement the actor
        model (and 6 in Scala)
            Looking for a place to Start? Try Akka
        Scala has no benefit, other than being more inherently
        focused on distributed/parallel programming
            Version 2.9.0 has parallel collections, actors are built in
            Scala research group got a 2.3M Euro grant recently to
            develop a simpler programming model for parallel apps




15-May-11                                                         WWW.TIKALK.COM
Scala Ecosphere
              Make Or Break

15-May-11
Companies that Use Scala




  There are more - http://www.scala-lang.org/node/1658

15-May-11                                                WWW.TIKALK.COM
Scala Frameworks
        Akka:
        an alternative approach to JEE, with distribution support and
        several alternatives for concurrency models
        Lift:
        Full stack for web applications
        Scalate:
        Templating framework
        Play framework:
        Moving to Scala
        flockdb:
        a distributed fault tolerant graph database by twitter
        specs, scalatest, scalacheck:
        testing frameworks for scala that go beyong junit

15-May-11                                                        WWW.TIKALK.COM
Build / Development Environment

        sbt:
        A build tool that uses Scala for its build files and has
        great integration with various frameworks

        maven-scala-plugin:
        supports compilation, testing, documentation

        IDE Support:
        Eclipse, IntelliJ, NetBeans




15-May-11                                                    WWW.TIKALK.COM
Scala Job Trends




15-May-11          WWW.TIKALK.COM
Q&A
              If you don't ask now -
            you can always ask later!




15-May-11
Thank You

            zvika@tikalk.com

15-May-11

Más contenido relacionado

La actualidad más candente

Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...Miles Sabin
 
Java Presentation
Java PresentationJava Presentation
Java PresentationAmr Salah
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open InnovationTim Ellison
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 
PROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part IPROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part ISivaSankari36
 
Java unit1 a- History of Java to string
Java unit1 a- History of Java to stringJava unit1 a- History of Java to string
Java unit1 a- History of Java to stringSivaSankari36
 
Wakanda presentation, MunichJS, 2011-11-29
Wakanda presentation, MunichJS, 2011-11-29Wakanda presentation, MunichJS, 2011-11-29
Wakanda presentation, MunichJS, 2011-11-29Thibaud Arguillere
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaDerek Chen-Becker
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part ISivaSankari36
 
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
 
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
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of JavaFu Cheng
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaEdureka!
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1myrajendra
 

La actualidad más candente (20)

Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
Scaladays 2010 - The Scala IDE for Eclipse - Retrospect and Prospect for 2.8 ...
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
PROGRAMMING IN JAVA
PROGRAMMING IN JAVAPROGRAMMING IN JAVA
PROGRAMMING IN JAVA
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open Innovation
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 
History of Java 1/2
History of Java 1/2History of Java 1/2
History of Java 1/2
 
PROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part IPROGRAMMING IN JAVA- unit 4-part I
PROGRAMMING IN JAVA- unit 4-part I
 
Java unit1 a- History of Java to string
Java unit1 a- History of Java to stringJava unit1 a- History of Java to string
Java unit1 a- History of Java to string
 
Wakanda presentation, MunichJS, 2011-11-29
Wakanda presentation, MunichJS, 2011-11-29Wakanda presentation, MunichJS, 2011-11-29
Wakanda presentation, MunichJS, 2011-11-29
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
PROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part IPROGRAMMING IN JAVA -unit 5 -part I
PROGRAMMING IN JAVA -unit 5 -part I
 
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
 
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
 
The Evolution of Java
The Evolution of JavaThe Evolution of Java
The Evolution of Java
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Hibernate example1
Hibernate example1Hibernate example1
Hibernate example1
 
Java modules
Java modulesJava modules
Java modules
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
 
Scala in a nutshell
Scala in a nutshellScala in a nutshell
Scala in a nutshell
 

Similar a Scala introduction

A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scalafanf42
 
Ten Compelling Reasons to Go the Scala Development Way - Metadesign Solutions
Ten Compelling Reasons to Go the Scala Development Way - Metadesign SolutionsTen Compelling Reasons to Go the Scala Development Way - Metadesign Solutions
Ten Compelling Reasons to Go the Scala Development Way - Metadesign SolutionsMetaDesign Solutions
 
Selling Scala to your boss
Selling Scala to your bossSelling Scala to your boss
Selling Scala to your bossJoão Bernardino
 
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
 
Assist software awesome scala
Assist software   awesome scalaAssist software   awesome scala
Assist software awesome scalaAssistSoftware
 
Scala for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.brandongulla
 
Scala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJScala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJRodrigo Lima
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistpmanvi
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuHavoc Pennington
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its EcosystemLessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its EcosystemPetr Hošek
 
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
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMarakana Inc.
 
Learn scala and it's componenents learn it
Learn scala and it's componenents learn itLearn scala and it's componenents learn it
Learn scala and it's componenents learn itsiddharth30121
 
Why scala - executive overview
Why scala - executive overviewWhy scala - executive overview
Why scala - executive overviewRazvan Cojocaru
 

Similar a Scala introduction (20)

A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Ten Compelling Reasons to Go the Scala Development Way - Metadesign Solutions
Ten Compelling Reasons to Go the Scala Development Way - Metadesign SolutionsTen Compelling Reasons to Go the Scala Development Way - Metadesign Solutions
Ten Compelling Reasons to Go the Scala Development Way - Metadesign Solutions
 
Fp and scala
Fp and scalaFp and scala
Fp and scala
 
Scala a case4
Scala a case4Scala a case4
Scala a case4
 
Selling Scala to your boss
Selling Scala to your bossSelling Scala to your boss
Selling Scala to your boss
 
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...
 
Assist software awesome scala
Assist software   awesome scalaAssist software   awesome scala
Assist software awesome scala
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
What is scala
What is scalaWhat is scala
What is scala
 
Scala for n00bs by a n00b.
Scala for n00bs by a n00b.Scala for n00bs by a n00b.
Scala for n00bs by a n00b.
 
Scala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJScala Introduction - Meetup Scaladores RJ
Scala Introduction - Meetup Scaladores RJ
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologist
 
Scala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on HerokuScala, Akka, and Play: An Introduction on Heroku
Scala, Akka, and Play: An Introduction on Heroku
 
Lessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its EcosystemLessons Learned: Scala and its Ecosystem
Lessons Learned: Scala and its Ecosystem
 
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...
 
Unit 1 notes.pdf
Unit 1 notes.pdfUnit 1 notes.pdf
Unit 1 notes.pdf
 
Martin Odersky: What's next for Scala
Martin Odersky: What's next for ScalaMartin Odersky: What's next for Scala
Martin Odersky: What's next for Scala
 
Learn scala and it's componenents learn it
Learn scala and it's componenents learn itLearn scala and it's componenents learn it
Learn scala and it's componenents learn it
 
Why scala - executive overview
Why scala - executive overviewWhy scala - executive overview
Why scala - executive overview
 
The State of Scala
The State of ScalaThe State of Scala
The State of Scala
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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 ...
 

Scala introduction

  • 1. By : Zvika Markfeld Tikal Knowledge Scala TCE Introduction to The Scala Language Developer Productivity Redefined 15-May-11
  • 2. Agenda Introduction Language Features Ecosphere Q&A 15-May-11 WWW.TIKALK.COM
  • 3. Introduction History, Motivation, Whos & Whos 15-May-11
  • 4. What is Scala? General purpose, compiled language Relatively new (2003) Designed to express common programming patterns Concisely Elegantly In a type-safe way Originally intended to run on both the JVM and the CLR After some time, the .NET implementation fell aside Later on, thanks to a grant from Microsoft, work resumed Resembles dynamic languages such as Python / Ruby Combines OO and functional languages features 15-May-11 WWW.TIKALK.COM
  • 5. Personal Issues Created by Martin Odersky, a computer scientist at EPFL in Lausanne, Switzerland. Co-designer of Java's generics, and the original author of the current javac James Gosling: "If I needed to choose a language other than Java, it would be Scala" James Strachan (Groovy creator) has left Groovy and now advocates Scala "If I had known Scala when I created Groovy, I would have probably not created it at all " 15-May-11 WWW.TIKALK.COM
  • 6. Static Typing Scala is a statically-typed language, unlike Ruby or Python Better IDE assistance Code completion Refactoring support Developer productivity enhanced Safer code via compile-time checks Better performance Enhancing developer productivity No need to wait for JSR-292's invokedynamic for performance boost As in Groovy, JRuby, Jython, … Code size is typically reduced by a factor of 2-3 compared to Java 15-May-11 WWW.TIKALK.COM
  • 7. Compatibility The Scala compiler generates Java bytecode 100% compatible with the JRE Seamless use Java objects in Scala and vice versa Deploy Scala applications to any JEE container / Android Reuse existing tools, servers, libraries Keep existing knowledge & workers Make the change gradually Java -> Jala -> Scala 15-May-11 WWW.TIKALK.COM
  • 8. What Went Wrong with Java? Oh, quite a few things: Java is over-verbose Stopped evolving Long adoption of new development idioms Functional programming, for instance Political / Marketing Issues (ok, Oracle) "Learning Java stunts your intellectual growth as a developer" [at least, some would say] 15-May-11 WWW.TIKALK.COM
  • 9. Why Prefer Scala Over Java ? Scala corrects many of Java's mistakes: Everything is an Object Type inference var dummy= Map[String,Int]() True Mixins, Traits, Duck Typing Functional programming language concepts Fresh start, no backward compatibility constraints Generics, anyone? More compact No getters, setters, equals(), hashCode(), toString(),... 15-May-11 WWW.TIKALK.COM
  • 10. ...Scala over Java Allows using new idioms and ways of programming Mostly just too laborious to do in Java Less LOC doing the same amount of work Better readability Never use anonymous inner classes again But still, leverage your Java code from Scala Productivity benefits Looks like a dynamically typed language While actually being 100% statically typed 15-May-11 WWW.TIKALK.COM
  • 11. Polyg-wha? It is common advice that you should learn multiple programming languages Scala integrates functional programming with OO programming Scala allows you to gradually learn functional techniques while still being able to use familiar object-oriented techniques Useful when migrating from Java Learning Scala may be easier than learning non- OO functional languages 15-May-11 WWW.TIKALK.COM
  • 12. Functional Concepts in Scala Functions are first-class values Convenient closure syntax Lazy evaluation Pattern matching Tailcall optimization Powerful generics (*) Still, Scala feels less functional because its core syntax is largely in the tradition of Java, not Lisp, ML, or Haskell, the three most prominent ancestors of functional language families) 15-May-11 WWW.TIKALK.COM
  • 13. Performance On par with Java Some features of Scala can produce faster code Specialization Inlining Laziness ...While other features makes it slower 15-May-11 WWW.TIKALK.COM
  • 14. Language Features What's all the fuss about, then? 15-May-11
  • 15. Higher Order Functions Functions are first-class objects Can be assigned to variables Passed to other functions Same as any other data type Code made more concise and readable ...not quite as concise as in some other functional languages But much, much better than the equivalent Java code 15-May-11 WWW.TIKALK.COM
  • 16. Side Effects Problem In OO languages, objects may contain state - mutable instance data When a method uses mutable data, it now has side effects Reading or writing any state which is not an incoming or outgoing argument Functions with side effects Are harder to test Harder to reason about In general harder to get right As more side effects are added, they accumulate, making the composed function even more difficult to get right 15-May-11 WWW.TIKALK.COM
  • 17. Immutable Values Using immutable values... Makes it easier to write code without side effects Reduces the likelihood of concurrency bugs Can make code easier to read and understand Scala separates the concept of a val from a var: A val in Scala is like a final variable in Java A var is a regular variable No "default" mutable - forces you to think about that choice Scala also has support for immutable data structures When you add to immutable Map/List/Set in Scala, you get a new object: Old keys and values are not copied, but shared 15-May-11 WWW.TIKALK.COM
  • 18. Referential Transparency The Imperative Way: Use variables (mutable data) and loops The Functional Way: Recursion & higher order functions, without mutable data Referentially transparent -> Deterministic Calling a function with a specific set of values as arguments will always return exactly the same value 15-May-11 WWW.TIKALK.COM
  • 19. Actor Concurrency The Java thread/monitor model works quite well... For a small number of threads Dealing with a very small number of shared objects But a synchronized method isn't referentially transparent! Scala supports the Java approach, but it also provides another model for better scale-up: the Actor model Message-queue mechanism borrowed from Erlang A language designed for high concurrency 15-May-11 WWW.TIKALK.COM
  • 20. Actor Mechanics An Actor is responsible for maintaining data shared by multiple threads Only the Actor is allowed to access that data Threads communicate with the Actor by sending messages to it The Actor can respond by sending messages back If the other thread is an Actor Typically the messages are immutable Each Actor has a message inbox where incoming messages are queued Scala's Actor library handles the message transfers The programmer does not have to deal with synchronization 15-May-11 WWW.TIKALK.COM
  • 21. Actors Are Way Better High-load programs often suffer from: Data corruption due to concurrent access. Deadlock Resource bottleneck or starvation Java's monitors alleviates the first problem Scala Also takes care of the second 15-May-11 WWW.TIKALK.COM
  • 22. Actor Libraries There are 6-7 libraries in Java that implement the actor model (and 6 in Scala) Looking for a place to Start? Try Akka Scala has no benefit, other than being more inherently focused on distributed/parallel programming Version 2.9.0 has parallel collections, actors are built in Scala research group got a 2.3M Euro grant recently to develop a simpler programming model for parallel apps 15-May-11 WWW.TIKALK.COM
  • 23. Scala Ecosphere Make Or Break 15-May-11
  • 24. Companies that Use Scala There are more - http://www.scala-lang.org/node/1658 15-May-11 WWW.TIKALK.COM
  • 25. Scala Frameworks Akka: an alternative approach to JEE, with distribution support and several alternatives for concurrency models Lift: Full stack for web applications Scalate: Templating framework Play framework: Moving to Scala flockdb: a distributed fault tolerant graph database by twitter specs, scalatest, scalacheck: testing frameworks for scala that go beyong junit 15-May-11 WWW.TIKALK.COM
  • 26. Build / Development Environment sbt: A build tool that uses Scala for its build files and has great integration with various frameworks maven-scala-plugin: supports compilation, testing, documentation IDE Support: Eclipse, IntelliJ, NetBeans 15-May-11 WWW.TIKALK.COM
  • 27. Scala Job Trends 15-May-11 WWW.TIKALK.COM
  • 28. Q&A If you don't ask now - you can always ask later! 15-May-11
  • 29. Thank You zvika@tikalk.com 15-May-11