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

TodoMVC with Bacon.js, Backbone.js and Transparency.js #419

Closed
wants to merge 1 commit into
base: gh-pages
from

Conversation

Projects
None yet
3 participants
@pyykkis

pyykkis commented Feb 2, 2013

Hi, I implemented TodoMVC with a following stack:

  • Bacon.js
  • Backbone.js
  • Transparency.js (disclaimer: I'm the author)
  • Require.js
  • CoffeeScript

Would you be interested in including it to the labs section? There's also PR #417 for plain jQuery + bacon.js implementation, by @raimohanska.

Rationale

Backbone models and collections are pretty awesome. However, Backbone views don't give you a much. Furthermore, both views and models rely on event handler pattern, which isn't really composable, e.g., when creating a new todo, one needs handle all key presses and check if the key is ENTER and then, if the value is non-empty etc. This leads to accidental complexity, as event handlers have to handle all cases instead of listening only ENTER key.

Additionally, it's difficult to avoid mutable and often global state with callbacks. E.g., in the original Backbone example, app.TodoRouter.setFilter sets global app.TodoFilter, which is read by TodoView.render via TodoView.isHidden.

Bacon.js (and FRP in general) lets one to compose fine-grained event streams and properties, and compose new streams on top of them with filter, combine and other "list processing" functions. Furthermore, global state can often avoided, as views can easily compose local properties, e.g., TodoApp.filteredList.

Finally, in order to pull things together, I wrote a small Backbone.EventStreams plugin, which wraps all Backbone.Event sources as Bacon.EventStreams. With the plugin, one can mix DOM events with Backbone events.

Cheers! :)

Jarno

@addyosmani

This comment has been minimized.

Show comment
Hide comment
@addyosmani

addyosmani Feb 2, 2013

Member

Thanks for this. As mentioned on the other bacon.js PR, we currently have a new apps freeze in place until the next release but would be happy to review this for the next one.

Note: To date, we've been more likely to merge implementations that fit one of the categories listed on the homepage. I see this one as being more close to Backbone + an extension framework (Bacon) however we'll know better once we've had a chance to understand Bacon better.

Member

addyosmani commented Feb 2, 2013

Thanks for this. As mentioned on the other bacon.js PR, we currently have a new apps freeze in place until the next release but would be happy to review this for the next one.

Note: To date, we've been more likely to merge implementations that fit one of the categories listed on the homepage. I see this one as being more close to Backbone + an extension framework (Bacon) however we'll know better once we've had a chance to understand Bacon better.

@pyykkis

This comment has been minimized.

Show comment
Hide comment
@pyykkis

pyykkis Feb 7, 2013

Thanks for the comments @patty and @addyosmani! And apologies @patty, I made some small cleanup, squashed the commits and lost your comment..d'oh.

@addyosmani, you're right, the closest matching category for this PR would probably be MVC Extension Frameworks: Backbone + Bacon.js (+ Require.js + CoffeeScript). I can also make a version without Require.js or in plain JavaScript, if that would be a better fit.

I check the issue list if there's anything I could help you with the release. In the meanwhile, thanks for the awesome job you're doing with TodoMVC!

pyykkis commented Feb 7, 2013

Thanks for the comments @patty and @addyosmani! And apologies @patty, I made some small cleanup, squashed the commits and lost your comment..d'oh.

@addyosmani, you're right, the closest matching category for this PR would probably be MVC Extension Frameworks: Backbone + Bacon.js (+ Require.js + CoffeeScript). I can also make a version without Require.js or in plain JavaScript, if that would be a better fit.

I check the issue list if there's anything I could help you with the release. In the meanwhile, thanks for the awesome job you're doing with TodoMVC!

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Feb 7, 2013

Member

@pyykkis Don't worry, I was just commenting on how beautiful the event stream definitions are. :)

Member

passy commented Feb 7, 2013

@pyykkis Don't worry, I was just commenting on how beautiful the event stream definitions are. :)

@passy

This comment has been minimized.

Show comment
Hide comment
@passy

passy Feb 20, 2013

Member

@pyykkis Thanks for the submission, but we discussed this internally and decided to pass on this. While interesting, we get a lot of implementations and we can't include them all. We felt that FRP is an interesting approach, but we want to prevent TodoMVC becoming a mere collection of different library combinations.

However we would really like it if you could add it to our wiki: https://github.com/addyosmani/todomvc/wiki/Other-implementations Thanks for understanding. :)

Member

passy commented Feb 20, 2013

@pyykkis Thanks for the submission, but we discussed this internally and decided to pass on this. While interesting, we get a lot of implementations and we can't include them all. We felt that FRP is an interesting approach, but we want to prevent TodoMVC becoming a mere collection of different library combinations.

However we would really like it if you could add it to our wiki: https://github.com/addyosmani/todomvc/wiki/Other-implementations Thanks for understanding. :)

@passy passy closed this Feb 20, 2013

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