backbone.validations icon indicating copy to clipboard operation
backbone.validations copied to clipboard

Question about overriding Backbone.Model

Open satchmorun opened this issue 13 years ago • 2 comments

First of all, great library. I'm finding it very useful.

I'm curious as to why you chose to override Backbone.Model instead of just keeping your version in it's own namespace (I do see there's a noConflict).

It just looks like the code might be little cleaner if you just used Backbone's extend and overrode the validate and _performValidation functions. You also wouldn't have to check if validate was an object because you wouldn't have to support the original way of doing validations.

I personally prefer to use your noConflict version, because that way when I extend Backbone.Validations.Model I'm clearly telling myself what behavior to expect from the model.

satchmorun avatar Jan 15 '12 15:01 satchmorun

After putting some thought into this, the seamless monkey-patching of Backbone.Model does seem like an unnecessary risk. I'm going to move everything into the Backbone.Validations.Model and make it only accept an object.

nealstewart avatar Jan 17 '12 20:01 nealstewart

I'll make a version 0.1 tag for the current release and mark the new API as 0.2.

nealstewart avatar Jan 17 '12 20:01 nealstewart