0

我正在寻找有关如何使用现有 JS MVC 框架之一将 JavaScript 应用程序重构为 JavaScript 应用程序的教程。有人有吗?

4

1 回答 1

3

Yes, I recommend the Backbone-Boilerplate located at GitHub.

This is beneficial because, not only do you get the Backbone MVC, but also require.js AMD, and underscore.js templates. The authors have been consistently active, and the code is impressive to work with.

Here are the associated tutorials:

  1. Introduction
  2. AMD Module setup
  3. Boilerplate
  4. Overview
  5. Router Explanation

These were the tutorials I used to get it up and running. Also included is Node.js and Grunt build system. They are very much worth the effort if you are not familiar with them. I just saw today that a jQuery project is incorporating the Grunt build system. This is a good setup.

UPDATE: Apologies if you were already aware of the boilerplate. I realize it does not directly relate to refactoring. This looks like a good post on refactoring MVC.

Documentation may be sparse as it would be specific to how your codebase is architected. The key notion would be Data maps to Model, GUI maps to View, Collections contain multiple models, and the Router is used to route events.

Hope that helps. All the best! Nash

于 2012-06-12T21:59:54.950 回答