Posts

Showing posts from December, 2010

Javascript/ECMAscript objects and namespaces

There seems to be quite a bit of confusion as to what these beasts are and what they're for. Hopefully, this article will clear up some of that confusion, although I certainly do not profess to be a real expert on any of the subjects herein and have simplified things before writing them down here. Reading up on the concepts dealt with here and implementing them was in fact prompted by a real-world problem that I came up against at work. Part of my work involves maintaining a control panel site, each page of which can contain multiple "components". Each component comprises three elements most of the time: a PHP template file that handles the display, a PHP class that manages the mechanics of the back-end (often invoked via an AJAX call) and, given that AJAX obviously involves JavaScript , an associated JavaScript file containing data and functions that tie the display and the back-end together. Different components are written/maintained by different members of the devel