Cw13 playing with scala by tamer abdelradi

  • 30 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
30
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Play-ing with Scala FuturesBackend guy at Cloud9rs Ltd.(aka Senior Software Engineer)tabdulradi@cloud9ers.comtwitter.com/tamer_radi(few tweets, if any!)
  • 2. About ScalaMartin Odersky● He designed Java Generics● Built the javac compiler● In 2001, designed Scala● In 2011, he foundedTypesafe Inc., a companyto support and promoteScala
  • 3. Who Uses ScalaMore: http://www.scala-lang.org/node/1658
  • 4. Why ScalaCan borrow from Java (runs on JVM)ConciseVery OOP, Very FunctionalStatically type, but with type inference.Lazy valuesclass Rectangle(val w: Int, val l: Int)class Square(s: Int) extends Rectangle(s, s)
  • 5. Why Scala - TraitsTraits for cross-cutting modularityLike Interfaces, but with implementationclass Man { def walk() {....} }trait SuperPowers { def fly() {....} }class SuperMan extends Man with SuperPowersval superMan = new SuperManval superMan = new Man with SuperPowersobject SuperMan extends Man with SuperPowers {def doLaserAndStuff() { ... } }
  • 6. Why Scala - ConcurrencyParallel Collections(1 to 10000).par.map(_ * 2).reduce(_ + _)Note: reduce operation is not orderedFuturesfuture { slowOperation() } foreach printlnprintln("Hey, I dont have to wait")Akka Actors (http://akka.io)
  • 7. Play FrameworkStateless (easy to scale)Built on AkkaNon-blocking I/O (uses JBoss Netty)Real-time & Streaming are First Class CitizinsWebsocketsEventSourceCometProduction support by TypesafeMany cloud deployment options
  • 8. Now Lets Code..The code is available onhttps://github.com/tabdulradi/weather