{"action":"created","issue":{"url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/55","repository_url":"https://api.github.com/repos/material-motion/material-motion-experiments-js","labels_url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/55/comments","events_url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/55/events","html_url":"https://github.com/material-motion/material-motion-experiments-js/issues/55","id":169761394,"number":55,"title":"Why RxJS","user":{"login":"appsforartists","id":926648,"avatar_url":"https://avatars.githubusercontent.com/u/926648?v=3","gravatar_id":"","url":"https://api.github.com/users/appsforartists","html_url":"https://github.com/appsforartists","followers_url":"https://api.github.com/users/appsforartists/followers","following_url":"https://api.github.com/users/appsforartists/following{/other_user}","gists_url":"https://api.github.com/users/appsforartists/gists{/gist_id}","starred_url":"https://api.github.com/users/appsforartists/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appsforartists/subscriptions","organizations_url":"https://api.github.com/users/appsforartists/orgs","repos_url":"https://api.github.com/users/appsforartists/repos","events_url":"https://api.github.com/users/appsforartists/events{/privacy}","received_events_url":"https://api.github.com/users/appsforartists/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/labels/type:%20Documentation","name":"type: Documentation","color":"BBDEFB"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-06T18:56:21Z","updated_at":"2016-08-13T00:18:45Z","closed_at":null,"body":"Concerns have been raised about how and when it's appropriate for us to use RxJS:\r\n\r\n1. What's the impact on bundle size?\r\n  - Our MVP, built with RxJS, is 20K gzipped.  We use tree-shaking (currently [rxjs-es](https://www.npmjs.com/package/rxjs-es) + webpack - possibly [closure](https://developers.google.com/closure/compiler/) in the future) to make sure we only import the parts that we use.\r\n2. It's a different mental model for most developers.\r\n  1. How will it impact adoption?\r\n    - Material Motion itself is a new mental model that we'll be teaching.  If there's value in teaching Rx as part of that, we certainly could.\r\n    - **The current API is usable without understanding Rx at all** - it's only used for the internals.  Rx may be a more advanced concept (e.g. if you are creating custom Performers, which most people won't need to do.)\r\n  2. How will it impact contribution?\r\n    - For core contributors, it shouldn't be a huge concern.  I went from curiosity to comfortable understanding in a week.  If we keep using Rx, I'll put together some resources explaining what Rx is, how it works, and how we use it, all in the context of Material Motion.  That should make it even easier.\r\n3. Is it compatible with Google-internal products?\r\n  - It should be.  Angular 2 depends on it, and it's checked into [Piper](http://www.wired.com/2015/09/google-2-billion-lines-codeand-one-place/).\r\n\r\nI should write up a document addressing these concerns and explaining why Rx is an appropriate tool for Material Motion.  This issue is a place for me to keep notes until that happens.\r\n\r\nMaterial Motion is largely concerned with representing change over time.\r\n\r\n- Representing interactions over time as single plans, e.g. draggable.\r\n- Tracking whether or not the system is at rest, and notifying observers (e.g. Directors) when this changes.\r\n- Updating a target's properties over time, framewise.\r\n\r\nRx is a highly-composable way to model change over time.  It feels like a really good fit."},"comment":{"url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/comments/239588695","html_url":"https://github.com/material-motion/material-motion-experiments-js/issues/55#issuecomment-239588695","issue_url":"https://api.github.com/repos/material-motion/material-motion-experiments-js/issues/55","id":239588695,"user":{"login":"appsforartists","id":926648,"avatar_url":"https://avatars.githubusercontent.com/u/926648?v=3","gravatar_id":"","url":"https://api.github.com/users/appsforartists","html_url":"https://github.com/appsforartists","followers_url":"https://api.github.com/users/appsforartists/followers","following_url":"https://api.github.com/users/appsforartists/following{/other_user}","gists_url":"https://api.github.com/users/appsforartists/gists{/gist_id}","starred_url":"https://api.github.com/users/appsforartists/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appsforartists/subscriptions","organizations_url":"https://api.github.com/users/appsforartists/orgs","repos_url":"https://api.github.com/users/appsforartists/repos","events_url":"https://api.github.com/users/appsforartists/events{/privacy}","received_events_url":"https://api.github.com/users/appsforartists/received_events","type":"User","site_admin":false},"created_at":"2016-08-13T00:18:45Z","updated_at":"2016-08-13T00:18:45Z","body":"One nice use case for streams: normalizing inputs.  You can drive a transition with a stream of TouchEvents, MouseEvents, PointerEvents, ScrollEvents, or requestAnimationFrame by mapping any of them to the format performers expect downstream.  The performer shouldn't care what's driving it and doesn't need to with streams.\r\n\r\nSimilarly, you can compose together different pieces of the system by listening to their `isAtRestStream`s and reacting when those change.  Or, you can use streams in lieu of transactions to have a place to publish plans (either synchronously or asynchronously); the `DirectManipulationPerformer` can commit a stream of transform plans that ensure a target moves on every frame it receives a drag event.\r\n\r\nFinally, streams allow you to easily choose how much work to do on each frame.  If you know velocity is not needed in an interaction, you can omit the operator that computes it and do less work on each frame."}}
{"actor":{"display_login":"appsforartists"}}