Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Contributing to RxJava

Contributing to RxJava

In this presentation, I covered my contributions and experiences while contributing to Netflix's RxJava project as a part of completing my Reactive Programming course taught by Erik Meijer at the Delft University of Technology.

4c65fc25a7ba3ba7689ce3a040f200c5?s=128

Michael de Jong

July 05, 2013
Tweet

More Decks by Michael de Jong

Other Decks in Programming

Transcript

  1. Contributing to RxJava Michael de Jong - @java_devver

  2. But first some HISTORY

  3. STUFF...

  4. ...and then there were REACTIVE EXTENSIONS

  5. ...and then there were REACTIVE EXTENSIONS

  6. Excellent for GRAPHICAL user interfaces

  7. Excellent for GRAPHICAL user interfaces*

  8. None
  9. None
  10. None
  11. None
  12. None
  13. Front-end developers: AWESOME

  14. Back-end developers: JEALOUS

  15. Developers want Rx server-side

  16. Developers want Rx server-side

  17. Netflix decided to build RxJava

  18. So in short RxJava: SAME MAGIC DIFFERENT LANGUAGE

  19. My contributions

  20. My contributions AsyncSubject

  21. My contributions AsyncSubject BehaviorSubject

  22. My contributions AsyncSubject BehaviorSubject OperationSwitch

  23. My contributions AsyncSubject BehaviorSubject OperationSwitch OperationThrottle

  24. My contributions AsyncSubject BehaviorSubject OperationSwitch OperationThrottle OperationBuffer

  25. Emits the last received event when the Observable completes AsyncSubject

  26. None
  27. Emits the most recent event when you subscribe to it

    BehaviorSubject
  28. None
  29. Now these were FAIRLY SIMPLE

  30. Let’s try something A LITTLE HARDER

  31. Operates on an Observable of Observables Emits values from the

    most recent Observable OperationSwitch
  32. Doesn’t sound very hard, right?

  33. I did encounter some minor issues which required discussion

  34. None
  35. None
  36. None
  37. Only emits events which are the most recent event for

    a certain timespan OperationThrottle
  38. This one was... tricky

  39. None
  40. None
  41. The Rx .NET implementation is SUB-OPTIMAL!

  42. For every onNext() you schedule a task and cancel it

    when you receive an event before it has started.
  43. That’s pretty WASTEFUL

  44. We’re still looking into ALTERNATIVE throttling scheme

  45. Emits lists of events which are determined by time, count,

    or Observables OperationBuffer
  46. This is one complex $#@&%*!

  47. None
  48. None
  49. 10 variations!

  50. Two categories: 1. Sequential buffers 2. Overlapping buffers

  51. Sequential buffers buffer(count) buffer(timespan) buffer(timespan, scheduler) buffer(timespan, count) buffer(timespan, count,

    scheduler) buffer(bufferClosingSelector)
  52. Overlapping buffers buffer(count, skip) buffer(timespan, timeshift) buffer(timespan, timeshift, scheduler) buffer(bufferOpenings,

    bufferClosingSelector)
  53. Reformulated into two sub-problems: When to create a new buffer?

    When to emit an open buffer?
  54. Clean solution, however it’s 1,500 lines!

  55. Some take-away lessons:

  56. 1Very cool to contribute to a real project with really

    smart people!
  57. 2A fairly active group, but response-time could be better.

  58. 3Your work is highly valued, but also extensively reviewed!

  59. 4They’re nowhere near feature complete. They need your help!

  60. Contributing to RxJava