New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Observables as core design pattern #13

Closed
kitsonk opened this Issue Jan 20, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@kitsonk
Member

kitsonk commented Jan 20, 2016

Topic

Should we adopt RxJS/Observables as a core design pattern?

Background

The Reactive Extensions for JavaScript (RxJS) is a set of libraries to compose asynchronous and event-based programs using observable collections and Array#extras style composition in JavaScript.

They are like if you combined Events+Promises+Generators. Where Promises are either resolved or unresolved, and Generators require the consumer to request the next value, Observables sort of combine the two to make event based programming easier.

RxJS 5 is being rewritten and is done in TypeScript.

Considerations

  • How would we integrate it?
  • What APIs would it replace or supplant?
  • Can we integrate it into our build tooling?

@kitsonk kitsonk added the discussion label Jan 20, 2016

@morrinene morrinene added this to the Milestone 1 milestone Jan 21, 2016

@msssk

This comment has been minimized.

Show comment
Hide comment
@msssk

msssk Jan 23, 2016

Contributor

Reactive is a mature and widely-supported (across programming languages) library. Gaining the full benefit of using Reactive requires a fair amount of learning its paradigm and API, but one could also use it much like Dojo 1.x users currently use Observable, Evented, Promises, etc.

Reactive's mantra: Everything is a stream

  • Apache 2.0 licensed
  • Very broad project - ported to numerous languages and platforms
    • Well supported with official documentation; lots of tutorials and articles in addition
  • JavaScript port is authored in TypeScript (for the version 5 beta; current v4 release is JS)
  • Adheres to ES7 Observable spec
  • Lots of bindings (though we would probably end up wanting to create custom ones for some Dojo components)
  • Full project source is ~700 files, ~12MB (8MB being git files)

Since the source is TS, I think it should integrate into our development and build process like any other TS dependency.

Contributor

msssk commented Jan 23, 2016

Reactive is a mature and widely-supported (across programming languages) library. Gaining the full benefit of using Reactive requires a fair amount of learning its paradigm and API, but one could also use it much like Dojo 1.x users currently use Observable, Evented, Promises, etc.

Reactive's mantra: Everything is a stream

  • Apache 2.0 licensed
  • Very broad project - ported to numerous languages and platforms
    • Well supported with official documentation; lots of tutorials and articles in addition
  • JavaScript port is authored in TypeScript (for the version 5 beta; current v4 release is JS)
  • Adheres to ES7 Observable spec
  • Lots of bindings (though we would probably end up wanting to create custom ones for some Dojo components)
  • Full project source is ~700 files, ~12MB (8MB being git files)

Since the source is TS, I think it should integrate into our development and build process like any other TS dependency.

@kitsonk kitsonk assigned kitsonk and unassigned msssk Feb 11, 2016

@msssk

This comment has been minimized.

Show comment
Hide comment
@msssk

msssk Feb 13, 2016

Contributor

I think core/Evented becomes redundant
There is overlap with core/streams, but probably enough differences for both to be useful

Dojo 2 Reactive
dojo/on Observable.fromEvent(element, eventName, [selector]); Observable.fromEventPattern(addHandler, [removeHandler], [selector])
dojo/on#once Observable#single?
dojo/on#pausable Observable#pausable
dojo/on.emit (no similar functionality?)
util.debounce/createTimer/throttle (general-purpose) Observable#debounce/delay/throttle
lang/assign util/assign
object/is util/isObject

Reactive's Observable has some utility methods (and a Symbol shim):

  • util/SymbolShim
  • util/isArray
  • util/isDate
  • util/isFunction
  • util/isNumeric

Reactive also has some scheduler support - TODO: compare scheduler between Dojo and Reactive

Contributor

msssk commented Feb 13, 2016

I think core/Evented becomes redundant
There is overlap with core/streams, but probably enough differences for both to be useful

Dojo 2 Reactive
dojo/on Observable.fromEvent(element, eventName, [selector]); Observable.fromEventPattern(addHandler, [removeHandler], [selector])
dojo/on#once Observable#single?
dojo/on#pausable Observable#pausable
dojo/on.emit (no similar functionality?)
util.debounce/createTimer/throttle (general-purpose) Observable#debounce/delay/throttle
lang/assign util/assign
object/is util/isObject

Reactive's Observable has some utility methods (and a Symbol shim):

  • util/SymbolShim
  • util/isArray
  • util/isDate
  • util/isFunction
  • util/isNumeric

Reactive also has some scheduler support - TODO: compare scheduler between Dojo and Reactive

@kitsonk kitsonk modified the milestones: alpha.1, Milestone 1 Mar 11, 2016

@kitsonk kitsonk modified the milestones: 2016.04, alpha.1 Apr 8, 2016

@kitsonk

This comment has been minimized.

Show comment
Hide comment
@kitsonk

kitsonk Apr 8, 2016

Member

ReactiveX/RxJS Observables appear to be a good design paradigm. As @msssk points out, there are some additional activities we need to do in order to better integrate it. I will open other issues in relationship to this.

Member

kitsonk commented Apr 8, 2016

ReactiveX/RxJS Observables appear to be a good design paradigm. As @msssk points out, there are some additional activities we need to do in order to better integrate it. I will open other issues in relationship to this.

@kitsonk kitsonk closed this May 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment