Since switching over to JavaScriptMVC is a big change for us, we're breaking things down into small tasks, the first being StealJS.
It’s difficult to maintain good structure when developing JavaScript. As our team grows so does our code base, becoming larger and more unwieldy. Code gets everywhere: the bottom of the template (tricky to debug), inline, in a giant script.js file (sound familiar?) or scattered across many different files which take long to load and are hard to keep track of.
So we came up with a wish list in the name of better JavaScript structure and framework.
- Stick to jQuery. We could change to YUI, Dojo, or Prototype, all of which have good structure, but we’ve already invested lots of time in jQuery, which we’ve found to be easy to use and able to produce good results quickly.
- Compress all JavaScript files into one, cache it forever and put it on CDN, marking each revision in the filename (i.e. “production.12345.js”) so we always know which version is the most recent.
- Document our JavaScript.
- Unit-test our JavaScript.
- Use scripts to clean and lint our code, like JSLint.
- Use an MVC folder structure.
And we found a framework that grants all the items on this wishlist: JavaScriptMVC. With JavaScriptMVC, it’s like having JavaScript as a language plus JMVC plus a framework, just like Ruby and Rails, PHP, Zend, Python & Django, Perl & Catalyst…you get the point. JavaScriptMVC uses jQueryMX for its MVC structure, StealJS for compressions, FuncUnit for testing, and DocumentJS for documentation. It even comes with clean and JSLint. What more could you ask for?
Since switching over to JavaScriptMVC is a big change for us, we’re breaking things down into small tasks, the first being StealJS—a JavaScript utility suite that makes building, packaging and compressing JavaScript applications easy. Learn more at the official StealJS Site.
Tags: framework, JavaScript, JavaScriptMVC, jQuery, Steal.js, versioning