Skip to content
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

Replaced fixed order with dynamic ordering #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bmomberger-bitovi
Copy link
Contributor

@bmomberger-bitovi bmomberger-bitovi commented May 3, 2017

For #271, the automatic addition of data/callbacks when the real-time behavior is used, was a desired feature of can-connect, and necessitated some way for real-time to declare that it needed another package included while still preserving order. this changes the ordering code so individual behaviors can decide where in the order they should go, and allows other connect behavior authors access to this ordering.

  • This isn't quite ready yet, because the dependency objects are generally rather ham-handed, mostly deriving from the lines of order previously listed in connect.js plus some trial and error. Also tests have not yet been made for the new ordering code and for required deps.

  • Pursuant to the previous bullet point, a pain point about can-connect (that the dependencies between behaviors aren't clear from the docs or code, due to the relationship between behaviors stems from shared property names) can be somewhat remedied by using the dependency object to show where ordering must be enforced.

  • The dependency from one behavior to another may be in either the "base" direction (from object to proto) or the "derived" direction (from proto to containing object), and may be "optional" (enforce order if both behaviors are included) or "required" (if A is included then include B in the correct order).

@justinbmeyer
Copy link
Contributor

the behaviors shouldn't know about each other, this seems to create that situation?

@justinbmeyer
Copy link
Contributor

The idea behind can-interface is the dependencies should be on the method/property instead of a module.

@bmomberger-bitovi
Copy link
Contributor Author

What problem is solved by behaviors not knowing about each other?

@justinbmeyer
Copy link
Contributor

justinbmeyer commented May 4, 2017 via email

@bmomberger-bitovi
Copy link
Contributor Author

That doesn't change if behaviors reference each other by key as this PR does. Reimplement with same key => order preserved (by the list in existing code; by the inbound deps in this PR); Reimplement with different key => order can be determined by mutating connect.order in existing code, by declaring dependencies in this PR.

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

Successfully merging this pull request may close these issues.

2 participants