The past 3 years I’ve been using PureMVC pretty consistently in both my ActionScript and Objective-C projects. I’ve really enjoyed it’s workflow but when looking into the JavaScript port, was not interested in the dependencies required by the different JS ports (mootools, extjs or prototype). So, this weekend I spent some time in a local cafe here in Stockholm experimenting with creating a small MVC framework of my own in JavaScript.
I set out a few goals for myself:
A similar workflow to my usual process. In AS3, for example, I use a quality plug-in called Fabrication, which simplifies a few of the more medial tasks which occur in PureMVC.
As few or no dependencies required
Minimal size impact
What came out of this with was JS-MVC. Since it is only an experiment, the naming is quite generic but I think the outcome was quite successful. I put up some quick documentation on github if you are interested in reading more.
The successes from the experiment were the following:
It’s format is very similar to PureMVC. There exists a Facade, Commands, Models and Mediators. I renamed Notifications to Messages. Much easier to type.
I also included some of the features provided by Fabrication. Two examples were the mediator message interest function shortcuts “respondTo + {MSG_NAME}” and sugar methods for registering, removing, and retrieving other framework actors.
Total file size compressed and minimized was 5.7kb, which is a good chunk less than PureMVC + mootools minimized.
I ended up with only 1 dependency, which was John Resig’s Simple JavaScript Inheritence class. It looked like the best choice for the experiment.
The things I really ended up not happy with were:
Not being able to fit in multi-core and module functionality into the experiement, but eventually continuing this further could lead to those additions.
No unit-testing. Not really in the scope of the experiment but would have been a real nice addition.
MVC experiment in JS
The past 3 years I’ve been using PureMVC pretty consistently in both my ActionScript and Objective-C projects. I’ve really enjoyed it’s workflow but when looking into the JavaScript port, was not interested in the dependencies required by the different JS ports (mootools, extjs or prototype). So, this weekend I spent some time in a local cafe here in Stockholm experimenting with creating a small MVC framework of my own in JavaScript.
I set out a few goals for myself:
What came out of this with was JS-MVC. Since it is only an experiment, the naming is quite generic
but I think the outcome was quite successful. I put up some quick documentation on github if you are interested in reading more.
The successes from the experiment were the following:
The things I really ended up not happy with were: