Can anyone speak to the difference in approach between Blaze and React? Or are they doing essentially the same thing?
At first glance, this seems much better in terms of programmer productivity, given that it uses logicless templates rather than embedding HTML inside JS code. But I'd be curious if it's less performant.
React and Blaze both compile templates or components into an intermediate representation for their HTML structure (React's JSDOM; Blaze's HTMLJS). A lot of the difference in how they decide what DOM changes are necessary.
React re-renders components when data changes and diffs the resulting JSDOM. The diff algorithm is fast and has simple hooks to make it faster by letting you compare state and component properties.
Blaze doesn't diff the resulting DOM structure. Instead, Blaze diffs the data the components depend on. That data comes from reactive functions built on top of Deps, our dependency tracking system. When the component first renders, dependencies are tracked between data sources and rendered DOM elements (dependencies are automatically cleaned up when the component is taken off the page). Therefore when data changes, Blaze can directly update the relevant elements.
There is some overhead in Deps, our dependency tracking system, but Deps has been intentionally designed for supporting this efficiently (eg batching updates in a "flush" stage).
As for performance, our benchmarks have generally found that React outperforms Blaze when many elements change and Blaze outperforms React when few elements change (which is more common for typical operations on many web apps). We also have plans to improve performance on initial rendering.
There are some other difference worth noting: While a later version of Blaze will support easy APIs for re-useable components, React already has one. And the React component model is well-thought out, complete and in production use whereas the Blaze component model at the moment is only the implementation behind templates.
They are trying to solve the same problem: gatekeepers to any mutable data that affects your DOM -- but they do it in pretty different ways: (1) under the hood, Blaze tracks the DOM changes and applies them directly whereas React diffs the resultant HTML and applies the difference. (2) Blaze uses declarative templates for injecting HTML; React requires HTML to be built using virtual DOM elements in javascript.
Looking through the Blaze wiki I'd say that Blaze is more concerned with calculating updates based on changes in data (either by user action or networked bindings) and React is more concerned with managing the entire lifecycle of an element.
React will probably be easier to reason about down the line (despite the initial learning curve), while Blaze will "just work".
I took some time to read through the architecture document[0] on HTMLbars yesterday and parts of the Blaze description sound very familiar. As a general observation, both libraries are focused on outputting DOM rather than HTML strings, which is interesting for various reasons. Maybe I'm missing some of the history here re: interaction between Meteor & Tilde, but I wonder if HTMLbars could have been useful in building out Blaze had it been in the works sooner?
HTMLBars is an excellent project and indeed does share many design principles with Blaze. They also differ in a few ways. For example, HTMLBars plans to never support full inline expressions in templates, whereas that is an explicit future goal for Blaze. So even though parts of HTMLBars could have been used in Blaze, it wouldn't give us the flexibility needed to take Blaze in the direction we think is best for our users.
I've been working on a project that uses React with Meteor. One advantage that React has is that it's very easy to render the html on the server side. Once on the client React only updates this html if and when it needs to. Can Blaze do this? If not, are there plans to support it in the future?
Maybe you're kidding but I'm not sure that's really how it works. I'm sure they will do as many updates as necessary prior to a 1.0 regardless of current numbering.
Now that I've had time to check out the update in depth, I can say that this update actually affects my project in a huge way. It'll require refactoring probably around 500 of lines of code because of the elimination of {{#isolate}, {{#constant}} and preserve-inputs, and the new template.rendered functionality.
I want to write a web app, an SPA. After many years of not caring about web design [1], getting back into the game is very difficult, even if my programming skills are more than 10x what they were back then.
I'm sold on JS, as to me PHP is very ugly and incomprehensible. My stack currently looks like this:
I've only begun my project three weeks ago, but I would have hoped to have a prototype by now. Admittedly, I'm not working on this 40hrs a week, but still. I find it very hard to understand how everything fits together.
And then news like this appear, once or twice a week, which make me spend some hours reading on this or that new framework and how better it performs.
</rant>
[1] I did some flash, html and js about 6-7 years ago. Also learned enough php to be disgusted by it.
I am a new developer. I've used meteor for a couple toy projects, and found it really easy to get started. past the basics however, I found it really hard to get answers. I'm currently trying to write a simple backbone + node app to get my head around all the things meteor does automagically.
Are there any plans for learning resources coming from the meteor team?
A great learning resource is Discover Meteor - http://www.discovermeteor.com (purchase required, but great value for money, as it's been regularly updated since its release).
The videos on Evented Mind are fantastic to learn from as well - https://www.eventedmind.com (recently introduced a subscription model, though, some of the videos are still free to play).
[+] [-] sanityinc|12 years ago|reply
[+] [-] RaphiePS|12 years ago|reply
At first glance, this seems much better in terms of programmer productivity, given that it uses logicless templates rather than embedding HTML inside JS code. But I'd be curious if it's less performant.
[+] [-] avital|12 years ago|reply
React and Blaze both compile templates or components into an intermediate representation for their HTML structure (React's JSDOM; Blaze's HTMLJS). A lot of the difference in how they decide what DOM changes are necessary.
React re-renders components when data changes and diffs the resulting JSDOM. The diff algorithm is fast and has simple hooks to make it faster by letting you compare state and component properties.
Blaze doesn't diff the resulting DOM structure. Instead, Blaze diffs the data the components depend on. That data comes from reactive functions built on top of Deps, our dependency tracking system. When the component first renders, dependencies are tracked between data sources and rendered DOM elements (dependencies are automatically cleaned up when the component is taken off the page). Therefore when data changes, Blaze can directly update the relevant elements.
There is some overhead in Deps, our dependency tracking system, but Deps has been intentionally designed for supporting this efficiently (eg batching updates in a "flush" stage).
As for performance, our benchmarks have generally found that React outperforms Blaze when many elements change and Blaze outperforms React when few elements change (which is more common for typical operations on many web apps). We also have plans to improve performance on initial rendering.
There are some other difference worth noting: While a later version of Blaze will support easy APIs for re-useable components, React already has one. And the React component model is well-thought out, complete and in production use whereas the Blaze component model at the moment is only the implementation behind templates.
Happy to hear any other perspectives.
[+] [-] heck0045|12 years ago|reply
Here is one of the React core developers (Pete Hunt) on React integration with Meteor: http://www.youtube.com/watch?v=qqVbr_LaCIo (note this is before Blaze)
Regarding performance: https://groups.google.com/forum/#!topic/meteor-core/-px_AGhj...
[+] [-] colbyh|12 years ago|reply
React will probably be easier to reason about down the line (despite the initial learning curve), while Blaze will "just work".
[+] [-] cookrn|12 years ago|reply
[0] https://github.com/tildeio/htmlbars/blob/master/ARCHITECTURE...
[+] [-] avital|12 years ago|reply
HTMLBars is an excellent project and indeed does share many design principles with Blaze. They also differ in a few ways. For example, HTMLBars plans to never support full inline expressions in templates, whereas that is an explicit future goal for Blaze. So even though parts of HTMLBars could have been used in Blaze, it wouldn't give us the flexibility needed to take Blaze in the direction we think is best for our users.
[edit: Also, Blaze is shipped. :)]
[+] [-] pornel|12 years ago|reply
However, the tricky case they've run into:
has been solved in TAL:[+] [-] cslarson|12 years ago|reply
[+] [-] avital|12 years ago|reply
[+] [-] swah|12 years ago|reply
[+] [-] malokai|12 years ago|reply
[+] [-] pbreit|12 years ago|reply
[+] [-] malokai|12 years ago|reply
[+] [-] xiaoma|12 years ago|reply
[+] [-] chm|12 years ago|reply
I'm sold on JS, as to me PHP is very ugly and incomprehensible. My stack currently looks like this:
Node -> Express+Passport+Mongoose -> Bootstrap + Angular/Polymer + D3
I've only begun my project three weeks ago, but I would have hoped to have a prototype by now. Admittedly, I'm not working on this 40hrs a week, but still. I find it very hard to understand how everything fits together.
And then news like this appear, once or twice a week, which make me spend some hours reading on this or that new framework and how better it performs.
</rant>
[1] I did some flash, html and js about 6-7 years ago. Also learned enough php to be disgusted by it.
[+] [-] kawera|12 years ago|reply
[1] http://flightjs.github.io
[2] https://speakerdeck.com/anguscroll/cal
[+] [-] Void_|12 years ago|reply
I've tried something similar, that is Rails + Ember.js, and I find using Meteor.js easier.
[+] [-] grigio|12 years ago|reply
http://weuse.meteor.com
[+] [-] elsherbini|12 years ago|reply
I am a new developer. I've used meteor for a couple toy projects, and found it really easy to get started. past the basics however, I found it really hard to get answers. I'm currently trying to write a simple backbone + node app to get my head around all the things meteor does automagically.
Are there any plans for learning resources coming from the meteor team?
[+] [-] lbbenjohnston|12 years ago|reply
Recently rebuilt a client app in Meteor, ran into a few hurdles that I think are just part of the learning curve.
A few times I have come to the github wiki page & found some helpful tips: https://github.com/meteor/meteor/wiki
http://www.meteorpedia.com/ is in pretty active development, lots of links and the guys who run it are active on the Google Group also.
[+] [-] gales|12 years ago|reply
The videos on Evented Mind are fantastic to learn from as well - https://www.eventedmind.com (recently introduced a subscription model, though, some of the videos are still free to play).
[+] [-] emgee3|12 years ago|reply
[+] [-] gwen_bell_dang|12 years ago|reply
[deleted]