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.
Demo the reactive jargons
Mushtaq Ahmed
ThoughtWorks
@mushtaqA
getProductPage
getModule1
getModule2
getPricing
getProductSpec
square(a: Int): Intsquares(a: Seq[Int]): Seq[Int]
Demo
● Async and NonBlocking mean different things
○ Async is about API
○ NonBlocking is about Implementation
● Async API can b...
Blocking Non-blocking
Sync square(a: Int): Int XXX
Async square(a: Int): Future[Int] square(a: Int): Future[Int]
API
Imple...
Demo
● Blocking IO is contagious
○ ExecutionContext helps to quarantine it
● Separate ExecutionContext for Blocking and
NonBloc...
Demo
● Error handling in Future is a bit difficult for bulk
operation
● Observable is a nicer alternative
○ Yet to explore: Ret...
Single Multiple
Sync square(a: Int): Int squares(a: Seq[Int]): Seq[Int]
Async square(a: Int): Future[Int]
squares(a: Seq[I...
The code for demo is here:
https://github.com/mushtaq/pune-scala-symposium
● We like to teach Scala
● We are planning to offer a FREE training in Pune!
○ Screening based on coding test ;)
● 4 full ...
Thank you
Upcoming SlideShare
Loading in …5
×

Demo the reactive jargons by Mushtaq Ahmed, ThoughtWorks presented at Pune Scala Symposium 2014, ThoughtWorks

2,864 views

Published on

Sync, Async, Blocking, Non-Blocking, Streaming are the buzzwords in the reactive programming world. This talk will attempt to attach some meaning to them. It will also demo the performance and resource consumption patterns for blocking-io, Scala Futures and RxJava Observables for comparable programs. Finally, a command line application that consumes twitter streams API will demo what is possible using the new reactive abstractions.

Published in: Technology, Travel
  • Be the first to comment

Demo the reactive jargons by Mushtaq Ahmed, ThoughtWorks presented at Pune Scala Symposium 2014, ThoughtWorks

  1. 1. Demo the reactive jargons Mushtaq Ahmed ThoughtWorks @mushtaqA
  2. 2. getProductPage getModule1 getModule2 getPricing getProductSpec
  3. 3. square(a: Int): Intsquares(a: Seq[Int]): Seq[Int]
  4. 4. Demo
  5. 5. ● Async and NonBlocking mean different things ○ Async is about API ○ NonBlocking is about Implementation ● Async API can be implemented for Blocking calls! ● For NonBlocking calls, Sync API is not possible! ○ Macros and CPS transformations can be used to fake it
  6. 6. Blocking Non-blocking Sync square(a: Int): Int XXX Async square(a: Int): Future[Int] square(a: Int): Future[Int] API Implementation
  7. 7. Demo
  8. 8. ● Blocking IO is contagious ○ ExecutionContext helps to quarantine it ● Separate ExecutionContext for Blocking and NonBlocking IO ○ Like different speed lanes
  9. 9. Demo
  10. 10. ● Error handling in Future is a bit difficult for bulk operation ● Observable is a nicer alternative ○ Yet to explore: Retry, Timeout etc ● Observable API does not support backpressure ○ Be Careful not to introduce memory leaks
  11. 11. Single Multiple Sync square(a: Int): Int squares(a: Seq[Int]): Seq[Int] Async square(a: Int): Future[Int] squares(a: Seq[Int]): Future[Seq [Int]] squares(a: Seq[Int]): Observable[Int] Observable[Int] == Future[Iterable[Future[Int]]]
  12. 12. The code for demo is here: https://github.com/mushtaq/pune-scala-symposium
  13. 13. ● We like to teach Scala ● We are planning to offer a FREE training in Pune! ○ Screening based on coding test ;) ● 4 full day sessions ○ Two consecutive Friday-Saturdays ● Sometime in May or June ○ Will announce it via @punescala/Pune Scala meetup group
  14. 14. Thank you

×