0
Monday, 5th July 
Peter Pilgrim, Oracle Java Champion, 

SCALA, WHY NOW?
Brief History Scala

 Scala – Scalable Language
 Pre‐history
   1996 – 1997 Pizza, 1998‐2000 GJ
 2003 Experiment
 2006‐200...
Martin Odersky’s Scala Workshop
Why Scala?
                             • Closures
                             • Lambda Currying
             Functional
...
Functional Side

 Closures , Lambda Expression, Function 
 Types
 Immutable References to Objects (val)
 Immutable Objects...
Object Oriented Side

 Everything is an Object in Scala
 Better Static Classes (Object)
 Classes with reduced boilerplate
...
REPL ‐ Read, Evaluate, Print, Loop


 Execute Scala like a Scripting language
 Increasing support 
   Eclipse IDE , NetBea...
Repeat Until Construction #1a

package demo;

object Control {
  def repeatLoop ( body: => Unit ) =
     new Until( body )...
Repeat Until Construction #1b

import demo.Control;


object LoopDemo {
    def main( args: Array[String] ) {
        var ...
Quick Introduction to Currying

 Haskell Curry (1901 – 1982)
   American Mathematician & Logician
   Combinatory Logic
   ...
Repeat Until Construction #2
object Control {
    def repeat(body: => Unit) = new {
      def until(condition: => Boolean)...
Concurrency in Scala

 Actor based concurrency library (Bill Venners)
 Asynchronous messages
 Dispatch to threads; Fork Jo...
Taste of Concurrency #1
import scala.actors._
import scala.actors.Actor._

object TradeMessageProcessor extends Actor {
  ...
Taste of Concurrency #2
TradeMessageProcessor.start()


TradeMessageProcessor ! new FXForwardOrder ( /*...*/ )
TradeMessag...
Thanks For Your Attention!
For more information
  http://scala‐lang.org
  http://daily‐scala.blogspot.com/
  http://stack‐...
Upcoming SlideShare
Loading in...5
×

Javawug bof 57 scala why now

1,079

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,079
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Javawug bof 57 scala why now"

  1. 1. Monday, 5th July  Peter Pilgrim, Oracle Java Champion,  SCALA, WHY NOW?
  2. 2. Brief History Scala Scala – Scalable Language Pre‐history 1996 – 1997 Pizza, 1998‐2000 GJ 2003 Experiment 2006‐2009 Industrial strength  programming language “Make a better Java” 
  3. 3. Martin Odersky’s Scala Workshop
  4. 4. Why Scala? • Closures • Lambda Currying Functional • Immutables • Style • Full Types Object  • Hierarchical, Mix‐ Oriented Ins • Case Classes • Operators  Overloading Scalable • Pattern Matching • Extendable with  Libraries • Static compilation  Cross  to byte codes Platform • JVM  • Dot Net
  5. 5. Functional Side Closures , Lambda Expression, Function  Types Immutable References to Objects (val) Immutable Objects & Collections  Standard Scala Libraries Currying – Control Abstractions Last Statement is an Expression Tail Recursion
  6. 6. Object Oriented Side Everything is an Object in Scala Better Static Classes (Object) Classes with reduced boilerplate Traits , Mix‐ins, Self‐Types
  7. 7. REPL ‐ Read, Evaluate, Print, Loop Execute Scala like a Scripting language Increasing support  Eclipse IDE , NetBeans, IntelliJ New Tools, Ideas and Innovations SBT, Actors, Lift
  8. 8. Repeat Until Construction #1a package demo; object Control { def repeatLoop ( body: => Unit ) = new Until( body ) def class Until( body: => Unit ) { def until( cond: => Boolean ) { body; if ( cond ) repeatLoop(body).until(cond) } } }
  9. 9. Repeat Until Construction #1b import demo.Control; object LoopDemo { def main( args: Array[String] ) { var y=0; repeatLoop { println("found y="+y) y += 1 } { until ( y < 10 ) } } }
  10. 10. Quick Introduction to Currying Haskell Curry (1901 – 1982) American Mathematician & Logician Combinatory Logic Partial Functions U(x,y,z) == F(x) ‐> G(y) ‐> H(z)
  11. 11. Repeat Until Construction #2 object Control { def repeat(body: => Unit) = new { def until(condition: => Boolean) = { do { body } while (!condition) } } } // Jesper and Rex Kerr
  12. 12. Concurrency in Scala Actor based concurrency library (Bill Venners) Asynchronous messages Dispatch to threads; Fork Join
  13. 13. Taste of Concurrency #1 import scala.actors._ import scala.actors.Actor._ object TradeMessageProcessor extends Actor { def act() { loop { receive { case f: FXOrder => f.spotPrice() case m: MMOrder => m.maturityPrice() case “stop” => println(“Stopping now...”; exit case x: Any -> println(“Error: unknown msg: “+x) } } } }
  14. 14. Taste of Concurrency #2 TradeMessageProcessor.start() TradeMessageProcessor ! new FXForwardOrder ( /*...*/ ) TradeMessageProcessor ! new FXSpotOrder( /*...*/ ) TradeMessageProcessor ! new MMOrder( /*...*/ ) TradeMessageProcessor ! 2.87134 // Unknown Msg Error! TradeMessageProcessor ! “stop” // Processor stops
  15. 15. Thanks For Your Attention! For more information http://scala‐lang.org http://daily‐scala.blogspot.com/ http://stack‐overflow.com search on Scala Scala is the Java of the Future http://jroller.com/javawug
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×