4 ms·
These paradigms weren't introduced by Backbone - they are the standard MVC(Model/View/Controller) constructs in use across many technologies.
by MJR 15y ago
These paradigms weren't introduced by Backbone - they are the standard MVC(Model/View/Controller) constructs in use across many technologies.
- crescentfresh 15y agoWhat paradigms did you think I was referring to? (I didn't actually [mean to] specify any). To clarify, these are some of what I'm referring to (apologies for the code-style formatting - just trying to produce a list): - Backbone.Model/YUI App Model: - Backbone's .previousAttributes vs YUI's .lastChange, used to get the previous value of a changed attribute since the last "change" event - A separate, abstracted Model sync layer for communicating with a server (side note: Backbone 0.9's "sync" event is being introduced in YUI in the next release: http://stage.yuilibrary.com/yui/docs/model/index.html) - .cid (Backbone) vs .clientId (YUI), auto-generated id guaranteed to be unique among all models on the current page. - configuring how the .id property is populated by overriding the .idAttribute property - .collection (Backbone: the Collection containing this model) vs .lists (YUI: array of ModelLists containing this model) - Backbone.View/YUI App View: - .events object literal property that specifies event bindings via dom event delegation, with the css selector in the key - .el (Backbone) vs .container (YUI): managed property representing the view's "container". All delegated events are bound to this element. - Backbone.Collection/YUI App ModelList: - .model specifying the underlying model type by referencing the type's constructor function in the prototype definition directly (I've seen it referenced by global name before, never by constructor reference as Backbone does it) - .getByCid() (Backbone) and getByClientId() (YUI): get a model out of a collection via its auto-generated client id - Backbone.Router/YUI App Controller: class that maps URL changes to methods on the instance. They're also renaming "Controller" to "Router" in an upcoming release, following Backbone's doing of the same in 0.5.3. These are possibly too small to refer to as "paradigms", but the point still stands: they're borrowing these directly from Backbone. If they existed prior to Backbone, my apologies. Also, this is not necessarily a bad thing.
- chc 15y agoMost of these have very close parallels in previous MVC frameworks, such as Rails and Apple's Cocoa. I think the biggest reason YUI3 and Backbone look more similar to each other than to those is because they're both client-side JavaScript frameworks instead of backend like Rails or desktop like Cocoa.