Skip to content

Instantly share code, notes, and snippets.

View moschel's full-sized avatar

Brian Moschel moschel

View GitHub Profile
@moschel
moschel / JavaScriptMVC.md
Created March 27, 2011 18:56 — forked from jupiterjs/JavaScriptMVC.md
JavaScriptMVC Overview

Introduction

JavaScriptMVC is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework; packaging utilities for:

  • testing
  • dependency management
  • error reporting
  • package management
  • code cleaning
  • custom events
@moschel
moschel / JavaScriptMVC.md
Created May 29, 2011 03:04 — forked from jupiterjs/JavaScriptMVC.md
JavaScriptMVC Overview

The following is a VERY rough draft of an article I am working on for Alex MacCaw's @maccman's Book. It is very rough, but even now a worthwhile read. Suggestions / comments are very welcome! Please help me :-)

Introduction

JavaScriptMVC (JMVC) is an open-source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) front-end development framework, packaging utilities for testing, dependency management, documentation, and a host of useful jQuery plugins.

Yet every part of JavaScriptMVC can be used without every other part, making the library lightweight. Its Class, Model, View, and Controller combined are only 7k minified and compressed, yet even they can be used independently. JavaScriptMVC's independence lets you start small and scale to meet the challenges of the most complex applications on the web.

This chapter covers JavaScriptMVC's $.Class, $.Model, $.View, and $.Controller. The following describes each component:

@moschel
moschel / $.View.md
Created May 30, 2011 00:20 — forked from jupiterjs/$.View.md
$.View for Alex MacCaw's Book

$.View - Client Side Templates

JavaScriptMVC's views are really just client side templates. Client side templates take data and return a string. Typically, the strings are HTML intended to be inserted into the DOM.

$.View is a templating interface that takes care of complexities using templates:

  • Convenient and uniform syntax
  • Template loading from html elements or external files
  • Synchronous or asynchronous template loading
  • Template preloading
@moschel
moschel / deferreds.md
Created October 12, 2011 22:07 — forked from justinbmeyer/deferreds.md
Deferreds and 3.1

3.1 Backlog - Deferreds

jQuery 1.6 brought Deferred support. They are a great feature that promise to make a lot of asynchronous functionality easier to write and manage. But many people struggle with uses other than 'waiting for a bunch of Ajax requests to complete'. For JavaScriptMVC 3.1, we identified an extremely common but annoying practice that becomes a one-liner with deferreds: loading data and a template and rendering the result into an element.

@moschel
moschel / TemplatedEventBinding.md
Created October 18, 2011 05:57 — forked from justinbmeyer/TemplatedEventBinding.md
Templated Event Binding

3.2's $.Controller - Templated Event Binding Goodness

JavaScriptMVC 3.2 brings a lot of great features and enhancements. So many features that changes to $.Controller didn't make the cut for our upcoming 3.2 article. This article reviews 3.2's $.Controller and talks about templated event binding (something we neglected to write up for 3.1).

Bind and Memory Leaks

Neglecting to unbind event handlers is the easiest way to create memory leaks. This is extremely common in an MVC architecture as you constantly listen for model changes:

Task.bind('created', function(ev, newTask){

// add task to list

@moschel
moschel / proxy.js
Created November 9, 2011 06:46
Funcunit proxy
var fs = require('fs'),
path = require('path'),
http = require('http'),
host = '',
port = 80,
localport = 9999
// parse out command line options
process.argv.forEach(function(val) {
if (val.indexOf('--host') == 0) {
@moschel
moschel / knockout.md
Last active December 12, 2015 08:18

Title: KnockoutJS vs CanJS

This article will be a comparison of KnockoutJS to CanJS. Many developers have asked us how CanJS compares directly to other libraries. While often not a apples to apples comparison, having a good understanding of the differences between MV* libraries will help you make the right choice for how to build your apps.

Knockout's MVVM Pattern - Live bound templates coupled with observable objects, heavily influenced the development of CanJS.

But Knockout basically stops there, a library aiming at providing live bound templates and observable objects. CanJS is that and so much more (model layer, routing, better widget modularity support).

If you choose Knockout to build your large JavaScript application

@moschel
moschel / more.md
Created February 8, 2013 23:49 — forked from justinbmeyer/more.md
title tags author lead layout
Weekly Widget 4 - Paginated Grid
open-source jquerypp
justinbmeyer
Learn to use jQuery++'s $.Range to create content aware show / hide buttons.
post

This week's widget demonstrates the awesome power of jQuery++'s range helper. $.Range

@moschel
moschel / canvbackbone.md
Last active August 23, 2016 13:03
CanJS vs Backbone

Backbone helps you structure your application. This is great, but it doesn't solve the whole problem. CanJS helps you structure your application and lets you actually focus on the part that matters, which is your data.

CanJS essentially gives you all the simplicity of Backbone (model and control layer and no weird asynchronous event loop like Ember and Angular), along with more advanced features that make writing apps much faster and the code more maintainable.

Backbone is popular because its very simple and easy to understand. They are aiming for that level JUST above basic jQuery development, people who just learned jQuery and are looking for a way to organize their code a bit more. It provides this. So does CanJS. But for large complex applications, Backbone lacks a lot of the things we need to make a great app.

Live Binding

Backbone has no concept of binding data object and their changes to your templates.

CanJS and Backbone both provide structure for JavaScript applications through an MVC-like pattern.

CanJS

CanJS is a lightweight MVC framework built to provide structure for JavaScript applications. It is aimed at developers of any library who need a battle-hardened library that makes building complex applications easy. It is part of a larger offering named JavaScriptMVC from Bitovi (its creators) that has documentation, testing and dependency management tools.

Backbone

Backbone is a flexible, minimalist solution for seperating concerns in a JavaScript application. It provides just a little bit of structure to a jQuery application and has largely attracted developers who know just enough jQuery to get by and now want to organize their code a bit more.