It is a competitive advantage for websites to be fast and responsive. When building the AddThis Smart Layers tool suite, performance was a priority and first-class feature. Let’s take a look at some of the mobile and desktop performance best practices that I (and the rest of the AddThis team) used to make Smart Layers blazing fast.
Backbone-Require-Boilerplate is a popular open-source boilerplate library that I created to help promote best practices when using Backbone.js with Require.js. In the video, I walk through each boilerplate file, and explain in-depth how the library helps you create more maintainable applications. Enjoy!
Backbone.validateAll is a small Backbone.js plugin that provides an option to only validate Model properties that are currently being set or saved.
Backbone.validateAll originated from a failed Backbone.js pull request. The original pull request was created because of frustration with using the Backbone.js Model validate method when validating HTML forms.
Backbone.js v0.9.1 Changes
Since Backbone.js v0.9.1 and greater, Backbone Model validation was not made to elegantly handle form validation, since the default validate method will validate all Model attributes, regardless of what particular attribute is being set or saved. For certain use cases, it is necessary to only validate a certain Model property (or form field) without worrying about the validation of any other Model property (or form field).
Backbone core contributor, @braddunbar, presented a possible solution for this use case in the above mentioned pull request, but it still involved calling all of the validation methods within the
validate() method, which can negatively affect performance.
Here is a jsPerf Test showing the performance benefits when setting Backbone Model attributes with and without Backbone.validateAll.
What? I Actually Have to Show People How to Use My Project?
Popular Open Source (OS) projects are self promoted by their easy to read, organized, and exhaustive documentation. Great examples include Backbone.js, Can.js, jQuery++, Underscore.js, jQuery, HTML5 Boilerplate, Require.js, Twitter Bootstrap, and many more.
These projects realize that users expect their documentation to follow a common format that includes a table of contents that houses, at the very least, a Getting Started guide, a Demos/Examples section, and a forum section to ask questions. Additional sections (ie. annotated source code, Contributor Guide) targeting potential core project contributors may also be included.
All OS developers should take note of these documentation practices and follow them when promoting their own projects. When patrolling Github to find new and interesting projects, I often find myself dismissing a project right away if there is a lack of documentation.
The project could have the most readable, brilliant, and performant code known to man, yet I (and many other developers) would never know.
But Documentation Takes Too Long to Write!
It’s true, documenting your project may take longer than writing the project code itself. But there are open source tools that can help expediate the process…