I believe what I'm doing is called 'modular' (??) . Just learning Javascript.
I am currently keeping each module in a separate .js file. This makes for easy maintenance and troubleshooting.
Each file is formatted as a variable. This is an example of the wrapper for each of many javascript files:
var FreeHand = function( pixy ) { };
Let's say that file above (FreeHand.js) (along with many others) is called like so:
var theBakery = coolCakeBakeryWithOnlineCakeDesign = 'the Pixy Cakes Bakery in Avondale, Arizona';
var pixy = new Pixy( theBakery );
var coffee = new Coffee( pixy );
var decorator = new Decorator ( pixy );
var freeHand = new FreeHand( pixy );
var info = new InfoPanel ( pixy );
var oven = new Oven( pixy );
var pixyDust = new MagicPixyColors( pixy );
var tips = new HandyTips( pixy );
var signals = pixy.signals;
</script>
signals.js is used for communication between each module, in the few cases where it's needed.
My question is, is this a good format for 'optimal memory design' or -- basically assume I'm a novice, and is this a good format at all. Opinions? Help?
PS: if you want to see a LIVE EXAMPLE (where I copied this format from) (this is my first JS project), and see it working, check out: http://threejs.org/editor/