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

921 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Demo the reactive jargons

  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

×