-
Notifications
You must be signed in to change notification settings - Fork 331
-
Notifications
You must be signed in to change notification settings - Fork 331
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
Support for visualization/analysis/debugging tools #273
Comments
We should really look into allowing the wrapping of all created observables in Bacon.spy. That would allow tools to spy on all observables without forcing subscription. The alternative to that would be "subscribeWeakly" or something similar. |
After some thought, I'm starting to think that wrapping is not such a good idea:
So, maybe we should try the Weak Subscription thing as in #251 ? |
This is nice so far, however there is currently no way to name streams which would make analyzing dependency trees so much easier. Any plans to allow that somehow? |
Oh, that was easy. Just doing something like |
Still, in cases where a stream is not assigned to a variable, it seems like a shortcut like |
On a connected note, it seems |
I'm quite close to exclude this feature from release 0.7.0, because it's not quite ready yet. What we need is a way to observe the events and lifecycle of all Observables without forcing subscriptions on them (i.e. messing up their lifecycle). If we fully implemented #276 and #251, I think we would be ready. But we may release 0.7.0 without |
Naah, I'm not gonna wait for this. Will release 0.7.0 and get back to this one afterwards. |
I certainly can live without this for now. However, optional graph building (I'm using dagre-d3) is a very nice debugging tool, especially for visual checking if something is wrong in stream construction logic, so I'd be happy to see this finished in the future. |
As mentioned in #449: with this functionality it's already possible to build a somewhat generic introspection/debugging visualization tool. What we need is finalization of this feature and probably something like #251 to make it completely invisible. I've so far experimented with directed graphs (e.g. with dagre-d3 or vis.js) which come out very nice except for What I haven't done yet, but would like to, is something to visualize the actual dataflow, i.e. highlight current values in the directed graph. Another wish in that direction is to re-do https://github.com/baconjs/bacon.js/wiki/Diagrams with these visualization techniques and introduce interactive examples for as many combinators as possible. |
As mentioned in #454, I made an attempt at a new spy system in aec6862 The idea is that a |
I gotta test it out on my production code, which I can do tomorrow. However, a first glance suggests it's good. On an another test base at home, I've ported my directed graph visualization to the new spys and they work at least as good as the old ones. Getting a notification for every event is great and I hope it'll be a great help for visualizing event propagation. |
A couple of notes from production:
|
Thanks, @rassie! This is of course a breaking change in the sense that your old spies won't work; you need to have |
Hmm, you are right, I've missed that part about not needing to subscribe. With |
In the
feature/dependency-graph-dispatch
, I've made some improvement that will enable the implementation of development tools that can, for instance, visualize the event network and event flow going on. The improvements includeobservable.deps()
Returns an array of dependencies that the Observable has. For instance, for
a.map(function() {})
, the deps would return[a]
. This method returns the "visible" dependencies only, skipping internal details. This method is thus suitable for visualization tools.Internally, many combinator functions depend on other combinators to create intermediate Observables that the result will actually depend on. The
deps
method will skip these internal dependencies.observable.toString()
Returns a nice textual presentation of the stream. Covered in #265.
observable.internalDeps()
Returns the true dependencies of the observable, including the intermediate "hidden" Observables. This method is for Bacon.js internal purposes but could be useful for debugging/analysis tools as well.
observable.desc()
Returns a structured version of what
toString
returns. The structured description is an object that contains the fieldscontext
,method
andargs
. For example, forBacon.fromArray([1,2,3]).desc()
you'd getBacon.spy(f)
Adds your funcion as a "spy" that will get notified on all new Observables. This will allow a visualization/analytis tool to spy on all Bacon activity. Current implementation just calls your function, but maybe, it should allow you to wrap all created Observables in your own wrapper to make spying even easier? This would enable AOFRP (aspect oriented functional reactive programming) lol.
I'm planning to include this improvement in release 0.7.0
The text was updated successfully, but these errors were encountered: