Where I think Meteor is doing wrong with Blaze

Despite one of its former motto “embrace the community”, Meteor has always been pretty much closed. To get all the benefits of Meteor, beside which Blaze, you had to use a closed framework (no outside package, then a proprietary package system…). This made sense since it was an opinionated framework where all parts were designed to work together.

With the introduction of React, Meteor is imho loosing its killer features. For me the best feature of Blaze is the fact that template helpers are computation linked to Tracker. With react, you only get this lame “getMeteorData”, that feels hacky and patchy in the middle of React. And then you start to ask yourself “do i really need Meteor ?”. It’s pretty cool to “offer” React access to the community, but now i notice that there has been three weeks since react 0.14 is out, and meteor’s version has still not been updated. And then the lack of openness of the Framework start to not make so many sense.

8 Likes

Sorry, but reading through your posts is pretty tiresome, as they’re not only overly long but they also lack a proper structure. If you really care for people to get your arguments, please provide the TL;DR version of them.

3 Likes

We’re acutely aware of this. Consider that we think about this stuff 5 days a week, 9-5.

These are not the only two options! It’s a false dichotomy.

I feel like anything we do, ever, needs to be level-headed. I don’t think anyone has ever gotten anywhere useful without being level-headed about it. You don’t win anything by having poor planning, or reacting to things too hastily.

This sounds like strictly a bad thing to me - how many more users could different parts of the Meteor stack have if they were easier to use together with other libraries?

Honestly, if you don’t need Meteor, then you don’t! If the only thing keeping you on Meteor was that you were locked in to Blaze, then I would question that decision making process.

It has never made sense to me.

4 Likes

The angst that many developers (such as myself) are feeling is not merely about React vs Blaze. It’s about being sure that the stack you are building on is supported by MDG, and will be for the foreseeable future. What was originally sold as a full-stack opinionated framework now seems to be a collection of useful core libraries.

If you’re a JavaScript ninja, this might not phase you. But for me, who is building a real world project totally in JS for the first time, it’s concerning to see the ground move from under my feet a little. Now, there is no official router, or front-end framework.

This matters to a freelancer or to a small dev shop (or to anyone really) because there is not enough time and resources to pivot everytime a new “better” way comes around, we want the tools that we invest in to be supported over the long term (a.k.a stability). When the community is split between Blaze, React, and Angular, getting meaningful community support is hard. The same goes for other parts of the framework.

If React is the new official front-end, I’ll use it. Then when I have issues with React, I know I can get community support for using React with Meteor. But without official guidance, I don’t know if it’s just “hype” as others have said.

There should be an official, canonical way to build a meteor app - while still allowing for flexibility for tinkerers/advanced users. A framework should be opinionated. This helps you to get started quickly. This also good for newbies. Right now Meteor is definitely not for newbies.

@sashko knows what’s up. That’s why he’s putting together The Meteor Guide. But meteor should be (in my opinion) an opinionated framework through and through.

17 Likes

It’s not really a “false dichotomy” when I’m essentially saying: “let’s explore ideas, here are the 2 options I see, add some more, whatever options there are one must be picked and taken to the extreme.” Why take at least one to the extreme? Because that’s what’s happening around us. We need some really good stuff built. I don’t think the loosely coupled “well, it interconnects well-enough with most things” strategy is a winning strategy. We need at least one thing where we are the superior option like we have been in the past.

That all said, @sashko, what other options do you see?

Based on what I understand, the goal is for Meteor to be, in the medium term, the best JavaScript application stack. This means making an informed decision in many different areas. Perhaps this will bring us much closer to the “Facebook stack” than we were before, and this is reasonable because these are some proven technologies that are gaining a lot of traction and backing by people with a lot more time, money, and resources than MDG. For example, React probably has more people working on it than all of Meteor combined. However, as many people have remarked, React can be pretty hard to work with. I see that as an opportunity.

I would consider this to be a harmful opinion. When has anything being taken to the extreme resulted in something good? Usually most things are a result of many carefully considered tradeoffs.

6 Likes

nobody said anything about poor planning. Frustration/anger is a helpful step out of lower emotions such as apathy or depressions on the way to more positive vibes. It’s been how many level-headed decision-making processes were arrived at throughout history. So I think you’re misconstruing different stages of the process. When the dust settles and our voice is heard, we can huddle up and figure out a plan, but right now I don’t think you (someone who works at MDG) hears me. You’re latching on and focusing on the wrong stuff in what I’m saying @sashko.

1 Like

again, you’re not hearing what I’m saying, instead latching on to words like “extreme.” I’d say read between the lines to see what I’m saying, but you don’t even need to do that–I’ve been clearly stating it. But I’ll say it another way: Meteor has been so successful because it was more coupled than what was going on in the greater Node community. In a VERY EXTREME WAY MDG integrated and united the entire stack! It mixed and matched the best stuff, making great decisions regarding tradeoffs along the way. The system wasn’t as flexible as what was going on outside of Meteor, but a lot more powerful and simpler in the coupling and decisions made. So what I’m suggesting is they go that ridiculously extreme at either making blaze awesome, integrating and coupling it with everything it needs to be the best all the way to the “Native level” OR they do the same with GraphQL, Relay and whatever Facebook is sure to churn out down-stack.

That’s what I mean by ***“extreme”***. It’s an extreme amount of work. It requires an extreme amount of foresight. It takes an extreme commitment to a particular decision/path. What I mean is be bold like they have been in the past.

Now we can get caught up in the words, or what I actually mean. And just to redirect this somewhere productive, what do you think about the possibility that MDG builds ***“Blaze Native”***??? Is that even an option, too difficult and time consuming, why? etc. What about GraphQL, could that ever be a path for us, and what would it look like? What would the implications be? What would the true benefits be? The true idea with GraphQL is somehow it would make it easier for other DBs to integrate with Meteor. The initial idea for why Facebook made it was to make it so any backend system can easily integrate with React. But where that’s obviously going is to a place where any DB can not just interface but be made observably reactive. That’s the next step, the next “Standard” Facebook will release. Obviously there are challenges with observing the data like we have done with Mongo and the oplog. But just look at all the DBs start to make themselves more easily work with React/Relay by conforming to the GraphQL spec and building an interconnecting layer/binding. It seems next is “realtimeQL”–so DBs themselves can make themselves realtime (instead of us having to jump through hoops to make them realtime for them, like for example we are doing with MySQL). So just imagine Facebook doing it again–Facebook speccing out, laying the rules and groundwork for how DBs can become realtime, i.e. observable. Perhaps that’s the real problem here, we are constantly rolling our own solutions, but Facebook (powered by its clout) is rolling out standards. I’m just gonna leave it at that, because that’s a whole other pandora’s box. But maybe it isn’t–it actually epitomizes the juncture of the road we’re at, the supposed “false dichotomy”:

A) The more marketable standards-based approach

vs.

B) The quicker coupled walled-garden approach.

Part of this decision needs to include recognizing that we get the benefits of moving faster thanks to coupling. That’s how we can compete with the legions of developers in the React community. This is as opposed to the defeatist attitude we can’t compete because they have so many developers. We can compete–there code is so much more complicated, ours is more focused; that’s what we have on our side.

So that’s why i see the options: doubling down on coupling or joining the movement of standardized ware.

I’m personally am favoring the coupled “Blaze Native” route. I think in our case we could successfully be more like Apple than Android–the platform where it’s generally agreed upon superior apps are made, even if it is more closed off. So @sashko, respectfully, what do you think, can we even do that? Can MDG pursue the Blaze Native route?

1 Like

If they do that, what is left of Meteor?

It’s not necessarily a competition between Blaze & Meteor vs React & GraphQL. It can easily be a comparison between React/Angular/Whatever & Meteor and React & GraphQL.

If people want graphql and relay, fine, let them use it, since meteor wouldn’t have fit them anyway. Facebook has said they aren’t planning a livequery concept since they don’t need it and that’s the big difference between Facebook and MDG. Facebook develops for themselves, MDG develops for its users. Facebook has the advantage of being large, but MDG has the advantage of being small.

I think people are a bit anxious since for a long time Meteor has been alone (except some really minor competition from derbyjs), and now there is some competition. But I like Meteor and I see the competition as positive, since it will push Meteor to improve its platform.

This reminds me of the time I freelanced for a networking company that was afraid that anything they planned would be done by Cisco. But with that mentality, you get nowhere.

But maybe this thread is derailing from “what will happen with blaze” to “what will happen with Meteor”. For the last question nobody has an answer. For the first one there have been indications so maybe this thread should focus on migration paths or community groups to maintain Blaze?

1 Like

wow, that’s sad. We don’t have tens of millions of dollars to build it ;). I really hope that’s not the general sentiment at MDG HQ. Blaze has a better interface than React. Even with all the people in this thread professing their love for Blaze, I don’t think Blaze gets the credit it deserves. It’s a very natural interface for this sort of thing; it’s what you would expect. React, like all of Facebook’s recent open-source solutions is over-engineered. Also, new developers can totally start with Meteor + Blaze, but React literally takes it to the next level of complexity that will be over their heads. So say goodbye to being the starting platform for newb developers. React is easy to us developers who have been doing this for a while, but it’s not nearly as easy for someone just coming from HTML/CSS. They won’t be able to jump to React, and that will likely be as far as they get. Whereas the jump to Meteor/Blaze is a super natural next step. It’s magical even. It’s the easiest doorway I’ve ever seen into becoming a real developer, and moving beyond design.

Should we just give up now on ever having “Blaze Native”?

ps. but I do agree that Blaze needs to become a first-class project of its own, and acquire a stronger community contributing to it. Basically, similar to what In.Famous has done with Famous, but hopefully with more support from the mothership.

3 Likes

I personally like Blaze a lot. I think it would do pretty well as it’s own project.
There are people in the community that I know for a fact want to work on improving Blaze. Yes, I’m not a fan of MDG not prioritizing Blaze, but it is understandable. There are other more pressing features (in my opinion) that should be worked on.

Blaze works well right now and it is built out enough for the community to step up and help out. Honestly, when it comes down to it, Meteor is not going to thrive and stay ahead of other full stack solutions just off the contributions of MDG. The Meteor community CAN help with parts of the project (i.e. Blaze). This is where I see a big opportunity to start some sort of technical committee / governance model like NodeJS has.

@faceyspacey I think it is too early to think about building “Blaze Native”. We should focus on Blaze first and then think about how we can expand it for native applications. Granted, there is already React Native out there and you can easily build out your Meteor application in Blaze + Meteor and then have a standalone mobile app that is built on React Native + DDP. Granted, that leaves a lot o room for code not being reused, but it is a temporary solution while things get figured out.

I think this topic is getting a bit out of hand though, there are some good points, but it seems to be turning into some unnecessary arguments (IMO).

3 Likes

This would be nice but I think that a Blaze Native is way far away from happening. One would also need to handle the differences between mobile and web styling which is large project outside of the scope of Blaze.

It’s incredibly difficult to get this running better than React Native. If it’s not better than React Native then what’s the point? Separation of styling markup and logic won’t be attractive enough (IMHO).

or

We could just spend a few weeks polyfilling the areas of the Meteor client that use the browser, add a build step for React Native and call it a day. I’m already using it today with Meteor and it works really great (though better client integration would be great!)

IMHO more resources into different databases and a competitive solution for easy declarative data subscriptions (clients specifying data shape like Falcor or GraphQL) are a much stronger play.

6 Likes

This reminds me of python web frameworks Django and Turbogears. Both had their initial release around 2005. Their difference is Django is opinionated while Turbogears which is “built on top of numerous disparate libraries and middleware of best of breed components”. Although I chose Turbogears because I can use SQLAlchemy with it, in the end, in terms of user base and packages, Django won. It might be due to the fact that turbogears changes the libraries between versions, Turbogears basically went from Cherrypy based (v 1.x), to Pylons based (v 2). And also changed Templating from kid template to genshi.

From a business perspective, I would understand if MDG moves to support and concentrate on the most starred javascript/web projects out there such as bootstrap, angular, react as these are where they will potentially source potential paying customers moving forward.

However, I would love if MDG would further develop and have first class support for Blaze. Or at least allow willing and capable people like @awatson1978 and @mitar and others in the meteor community to develop Blaze further.

My two cents,
Dax

4 Likes

Agreed. Having a meaningful discussion about how Blaze could be better might help. Or how we can teach each other to build more maintainable Blaze front-ends.

React and Blaze solve different problems (i’m not too familiar with Angular). Blaze is designed to be simple and easy to use. React is designed to scale well with complexity (despite being more complex in small apps).

Cluttering up Blaze with more bolt-ons is only going to make it complex… taking away from what it’s good at.

I’m not sure what everyone is fussing about regarding the earth ending now that we have 3 view layers to choose from… Meteor’s philosophy (from how I remember it) was to be easy to do data over the wire… single page apps vs request/response apps, realtime data made easy.

When did Meteor become the stack where you meteor add your way into a fully built app?? so what if you have to choose between a package because it supports view A or database Z. Am I missing the point? The way to mitigate these pains is to de-couple packages so that your choice can easily be augmented (eg. FlowRouter).

If Meteor turns into a monolithic platform for where no choices can be made then it’s only good for beginners and prototyping. We already have Scratch and Mockups… let’s focus on building maintainable realtime JavaScript apps!

7 Likes

We also could build a layer on top of React to make it identical to Blaze–in other words add a bull step (among other things) to code that looks like Blaze, but is converted to React. The guys working on the Sideburns project have already done a lot of that. I think we can easily pull off replacing props with Tracker-based implicit contexts–the hard part will be transpiling Tracker-based “state” to React style explicit state management. But it very well could be doable.

So who says we can’t build something on top of React to greatly change (reads: enhance) its interface and make it identical to Blaze lol???

ps. keep in mind I’m referring to a Blaze that looks more like @mitar’s Blaze Components. So a hypothetical MDG-endorsed Components-based Blaze 2.0. Just by making Blaze components/class-based, it begins to look a lot more like React to begin with. That’s a big step, and one that won’t change too much how you’re currently working with Blaze, but enhance it. So at this point we’d be looking a lot more like React, but without killing our blaze skills/packages/etc. Sideburns has basically built support for spacebars templates instead of the render method. That primarily leaves state/props transpilation remaining. We might be able to meet in the middle with a beautiful solution.

3 Likes

Yea I agree if anything transpiling it from one to the other may be very do-able. However I still don’t get the overall goal (this is most likely because React is 2nd nature now). I don’t understand what Blaze components gives you over React (besides separate files).

When looking over Blaze components it seemed way more complex than React (assuming you had 0 knowledge of both). Although Blaze is still easier for designers to handle!

Perhaps this is also because in React data is more explicit… it just comes in as props just like params in a pure function… for example:

// React 0.14 stateless component syntax

export function Greeter(props) {
  return (
    <div>
       <span>Name: {props.name} </span>
    </div>
  );
}

I get that if you take the time to learn Blaze’s differences from handlebars then perhaps it’s less of a leap. Overall the big win for Blaze IMHO is the simplicity.

To each their own though! I think it’s great to have choices with the Meteor stack.

2 Likes

I’m sorry to say @mitar didn’t get it right. It is way way way too complex, and mainly because there’s lots of superfluous features. The interface should look like this

class MyComponent extends Meteor.Component {
    //LIFE-CYCLE handler:
    onRendered() {
	//do something:
        //`this.callSomeMethod()` yes, finally we dont have to write long procedural functions anymore!
        //`this.model()` will work consistently like below
        //`this.instance()` also consistently available in all methods, and provides access to state
        //`this.setState()` sets state on `this.instance()`
    },

    //EVENT handler automatically inferred to be an event rather than a helper (since it starts with `click`)
    ['click #bookmark']() {
        if(!Meteor.user()) Meteor.loginWithGithub(() => this.bookmark());
	else this.bookmark(); //call a method on this component, yay!
    },

    //METHOD accessible from `this` (yay!! finally!)
    bookmark() {
       this.model().bookmark(); //model is inferred from underlying spacebars/blaze context of above event handler
     },

    //HELPER accessible in the template
    bookmarked() {
       return this.model().bookmarked; //again data context is consistently accessible at `this.model()`
    }



   //BONUS: Relay type stuff (subscribe to 10 Order models, along with its hypothetical users relation):
   subscriptions() {
        return {
             Order: ['has_many', 'users', 'user_id', {limit: 10, sort: {createdAt: -1}}]
        };
   }
}

Disclosure: I’ve built this system already. That’s basically why I’m so hyped up about this matter. I have what Blaze 2.0 really should look like. @mitar’s system inspired me to do so, but i think this is cleaner and more natural, and ultimately its classes look a lot like React’s. It’s all Blaze 1.0 underneath the hood, so don’t get scared by defining events on the same class definition map as where you define helpers and life-cycle handlers. The main benefit is a consistent context for this so you can break up your code into shorter single-purpose methods.

So it’s this system I think should transpile to React. It doesn’t need to be this one exactly, but the point is to imagine Blaze 1.0 in “class-based” form. We can get there easily. It’s right here. Next, Sideburns basically replaced the need for React’s render() method with spacebars already. That means we are already on our way. Implicit props handling like Blaze does is probably no big deal, so that leaves just transpiling Tracker-based state to React explicit state management.

4 Likes

Though I have to say, major props to @mitar for building this, even if it isn’t my cup of tea. Doing this helps innovate Blaze and at the very least helps test out ideas.

Disclosure: I’ve built this system already. That’s basically why I’m so hyped up about this matter. I have what Blaze 2.0 really should look like

Very nice! It seems very simple.

What does this.model refer to? Is this the data from the subscription? Or is that something passed in at the template? In general I think the context in Blaze is one of the more brittle things at scale (IronRouter passing data via context was a nightmare debugging).

Is this.instance just the state or the entire object created from the constructor (class)?

I think something that’s needed with the next iteration of Blaze (or the current one) is how does a component share state with a sibling without the sibling pulling it out directly? My thoughts in earlier posts were to using something Om/Elm like with a single state object that all components can get in a structured way.

2 Likes

this.model() essentially refers to the data context available as this in blaze 1.0’s helpers, events (which they failed to keep consistent in life-cycle handlers). There’s a another method this.data actually that does this–this.model does a little bit more work to insure it finds a model object from a collection, not just any old javascript object. Anyway, this is typical context passed to the template that corresponds to this component class (rather, the view instance of that template). Nothing more. The subscriptions just allow you to pair up data to the component, so it’s the data that is there when it’s rendered. There is an isReady() method you can access in your spacebars code or anywhere in the component class to check the readiness of your configured template-level-subscriptions.

this.instance() is Template.instance() for the whole component–rather instantiated views corresponding to the component, essentially giving each instantiated view instance the ability to maintain its own state.

As far as your question about cross-view/component communication and state, this is also something I’ve been grappling with myself. My sense is that in Meteor/Blaze this is a lot less of an issue because of various factors. For one, you have mini-mongo, so you can make any changes on a model object and reactively have the changes propagated. But by React’s definitions that’s not true “state” anyway, but I do get the sense that because of minimongo’s presence it eliminates the need for React’s state pattern in many cases common to React. But if we are staying pure/true to React’s definition of state, true “state” seems to be client-only state not tied to some sort of model object (i.e. because you can have client-only collections as well, so that doesn’t count either). It’s things you typically put in Session or reactive vars/dicts attached to a template instance. By that definition, I’ve struggled with how big of a deal React has made state out to be since most of the time Session storage suffices (which I assume is similar to the idea you had for a “single state object”).

The closest thing to a more advanced “state” solution is of course using reactive vars/dicts on template instances. This gives you 2 things: 1) you don’t have to pollute Session storage, and 2) you can organize the code in logical groupings of related code. This brings us to the real problem we’re trying to solve: it’s hard to reach instance storage/state from other components in plain Blaze. Template instance storage isn’t easily reachable by other template instances like Session storage is. My system does have this.parentInstance(level) similar to template.parentData(level) that Meteor already has, but using that you would fall into the category of a “sibling pulling it out directly” as you mentioned. That however is not the true problem here either; arbitrarily traversing the tree is. So like you said, siblings searching for each other directly isn’t the solution either.

If you look closely at Blaze, you actually already have the building blocks of state placement control in event handlers. Because parent templates event handlers are called on child template elements, not just its own elements, we essentially already have the function-passing pattern React has, where a state-maintaining parent component passes a function down to a child template that therefore doesn’t have to worry about state, just that the event handler gets assigned. We don’t have this fully in Blaze proper, but we have this in my system because the event handler is bound to the original parent component (which is able to locate its template instance), thereby enabling you to use its instance storage even when triggered on a child template! So that means you have a situation where the state is moved up to a controller component that does most of the stateful work. Lastly, you get the same thing for helpers because they are also bound to the originating component. It boils down to one simple task: where you define the helpers and event handlers. So in addition to events being applied to all children template instances, helpers are applied as well. Child templates will get access to helpers in my system even if they don’t have their own component defined for them (or even if they do). It could be automatic, but currently it’s not–you must specify an array of includes, which are the names of templates to share these helpers.

In short, the premise is that child template instances can access the same event handlers and helpers of a parent component instance, including their instance storage and component context. With that you can move the responsibility of state to a higher up “controller” component.

1 Like

There are no analogies for Meteor in the past. Good or bad. Don’t try to find them for there are far more dead than survivors. And I’ve been to a lot of funerals.

Blaze is not Meteor’s kernel either, it comes some time after. At it’s birth it had a far weaker rendering system. It didn’t stop it getting as far as Blaze. So it’s possible that it can get past it too, although that’s not neccesarily the best outcome.

We all have a best future in mind, but we can’t all be right. Nor can we all be winners if we assume an either/or solution.

I’d like to see this discussion take a more consensual turn.

We can all hope for MDGs prosperity and longevity into the future. And maybe we all really want Meteor to be the best Over-The-Wire stack acknowledging that DDP/Tracker, while still needing improvements, can be coupled to Blaze, as a default frontend, and to others by choice such that the market for Galaxy widens.

What would this require to be achieved? I think a first good step would be to acknowledge that for all but the most basic apps, the opinion is that Meteor-flavoured web should component based with tightly coupled data sources. And, I guessm using ES6 type classes is the start of that.

Let’s find the future. Viva MDG, Viva Meteor.

3 Likes