-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
If you could change Backbone at will, how would you? #4290
Comments
What to keep: It seems that backbone is the only MVC-Framework for JavaScript that is still updated, so I would not change anything about that paradigm. What to keep/Improve: Use of ESModules without introducing the Backbone global or a build tool – #4274 What to improve: Use of ES6 classes (So I can What to improve: Not a huge problem for me, but using modern JavaScript (not cutting edge, just anything that works since a couple of years) and, with that, make underscore optional? Many functional-style methods has been added to JavaScript arrays by now, so maybe this is sufficient? Similarly Map and Set might be helpful in some occasions. Reasons: Size and code-readability for people not familiar with underscore. |
☝️ I endorse these suggested changes for a Backbone 2.0. |
So far, we have one response, which only suggests evolutionary changes, rather than anything radical. Would it be safe to conclude that Backbone users just want the library to be updated with recent JavaScript and otherwise stay mostly the same? If anyone thinks otherwise, please don't hesitate to respond. |
Not radical, either but:
|
A possible radical way to implement this, would be to unify A possible non-radical way would be to absorb the core functionality from backbone-fractal into Backbone itself. That would probably amount to introducing a new Yet another option is to just leave it to external libraries, as is currently the case. Marionette provides its own way to compose views, so how to do it in Backbone itself would probably be somewhat controversial.
Could you elaborate a bit on how you would like to see this intermediate documentation? In any case, pure documentation changes are never breaking, so this could be done before a 2.0 update already. Perhaps related: I have been wanting to deepen the indentation, which might already improve the readability. Such a change would best go together with a modularization, because that keeps all obfuscating changes in one batch. |
…for me would usually involve
Basically, something that helps understanding how different parts of the code work together and how to read the code.
No strong opinion, for me the fractal integration sounds most meaningful. |
@jdittrich I created a new issue (#4291) for your point about code understanding. It is a very good point and I think it does not need to (and perhaps should not) wait until the 2.0 release. |
I haven't written any Backbone applications in ages, so take this with the appropriate amount of salt. Change:
Keep:
|
Backbone has saved us a lot of time and give us a clear starting point. Greatly appreciate your work! |
I would push back against adding view functionality.. Marionette's team at one point intended on dropping backbone as a strict dependency as extending the view to allow for other renders was difficult. A big ask had been dropping jQuery, and that meant making backbone optional. Making that easier would be good. In order to do it now it feels like a hack or just large copy-pastes from the backbone source. You can generally see those modifications here: marionettejs/backbone.marionette#3679 Beyond that ESM would be great.. not sure if we've overcome the breaking issues of switching to |
For utmost clarity: which added functionality are you referring to here? |
absorb the core functionality from backbone-fractal in particular, but even the shadow DOM / custom elements.. backbone views should allow for that as a possibility without adding that as a required opinion. |
@paulfalgout absorbing backbone-fractal would mean adding a new class ( The custom element thing is not so much a feature addition but a radical total redesign of the library. So far, I don't have the impression that a lot of people would want that. |
It adds opinion to the library handled by other 3rd party libraries that now may be expected to support the new stuff. It would make more sense to me if a significant portion of backbone users had already adopted it, but historically a light View layer opinion was characteristic of Backbone, and I'm not certain how at this point in time embedding a particular solution is any better than just saying "if you need to do X, here are a few options" |
We had a big codebase with Backbone.js, Grunt for building, BEM for scoping CSS and plates for the view rendering. The latter was probably the biggest pain point. We rewrote that application to ES6 + react + redux many years ago now. I still think we've got performance regressions from the rewrite, not in small part to React being hard to grasp even though the initial DSL seems small and simple - but rewrites, hooks and memos will eventually come get you. I haven't used Backbone.js since our refactor, but have done quite a lot of work with web components. And I can't stop to think how Backbone.js combined with ES modules, template literals and web components (w/ CSS isolation in Shadow DOM) would be such a delightful stack now! The only work needed on the Backbone-side for that would be to support ES modules. |
@jgonggrijp: Our company has been heavily using Backbone for well over a decade, but (like most devs & companies) we no longer choose Backbone for new projects and we have been slowly converting large codebases to React. React's size, complexity and conceptual surface area are frightening and make it the polar opposite of Backbone ("smaller ... less conceptual surface area ... read and understand the source in an afternoon"). But React (and most recent UI frameworks) address a major pain point with Backbone: seamless view reactivity. Backbone views are reactive (they typically re-render in response to model changes), but this is not seamless in two ways:
The above shortcomings aren't that important when most changes are initiated by the current user, but we write applications for teams, so there are often incoming changes from other members of the team. These trigger re-renders, which either result in bugs or requires a good bit of code workaround to manage. In contrast, React & most recent UI frameworks handle this seamlessly (though I'll be the first to admit that these frameworks bring a boatload of other problems). I do appreciate how Backbone is rendering-agnostic. Here are a couple possible ways to address the above issues while remaining render-agnostic:
Less important requests:
|
@prust thank you for chiming in. Please allow me to comment on what you wrote:
Backbone is indeed render-agnostic, so I would not agree that coarse-grained reactivity is an intrinsic trait. That being said, I understand that people might often end up implementing their own rendering logic in a coarse-grained way.
backbone-fractal and (slightly more bluntly) Marionette.CollectionView already handle this perfectly.
It's a tradeoff. Backbone gives you all the tools you need to write an efficient application with fine-grained reactivity (if needed), but leaves it (mostly) to you to figure out how to do that. React and other component frameworks give you one low-effort approach to update the DOM that works well most of the time, but they will actively hinder you if you need to manage the DOM in a different way and they don't provide a good model layer.
I think this is a good suggestion. Since it is a documentation change, it would not need to wait until a 2.0 release.
As I wrote above, backbone-fractal and Marionette already do this. I agree there is added value to mentioning them prominently in the documentation, though.
A common request, but I must point out that delegated events are both very efficient (so desirable to keep) and hard to implement without jQuery.
These return promises (i.e., jqXHR) already; you can |
Sooner or later, there will be a Backbone 2.0. Major releases are disruptive for users, so I prefer to make them as infrequently as possible. But when we do one anyway, we might as well use it to its full potential.
This is a "wild ideas" ticket, where you can suggest any backwards-incompatible changes that you would like to see in a future release of Backbone. Please keep it brief, but do explain why you would like to see the change(s) that you suggest.
You are also welcome to highlight anything that you want to stay the same. Again, please with reasons.
Some rules of the game:
The following prior tickets are somewhat related: #4274, #4245, #3560.
The text was updated successfully, but these errors were encountered: