Cw13 playing with scala by tamer abdelradi

206 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
206
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cw13 playing with scala by tamer abdelradi

  1. 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. 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: http://www.scala-lang.org/node/1658
  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).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. 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 onhttps://github.com/tabdulradi/weather

×