Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cw13 playing with scala by tamer abdelradi


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Cw13 playing with scala by tamer abdelradi

  1. 1. Play-ing with Scala FuturesBackend guy at Cloud9rs Ltd.(aka Senior Software Engineer) tweets, if any!)
  2. 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. 3. Who Uses ScalaMore:
  4. 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. 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. 6. Why Scala - ConcurrencyParallel Collections(1 to 10000) * 2).reduce(_ + _)Note: reduce operation is not orderedFuturesfuture { slowOperation() } foreach printlnprintln("Hey, I dont have to wait")Akka Actors (
  7. 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. 8. Now Lets Code..The code is available on