Jean-Marc Orliaguet wrote:

>> I'll put a section in the guide "when to choose a class what it brings,
>> a simple variable, etc..."
>
>
> great, and add something about using the 'prototype' property on
> instanciated objects to reduce memory usage.
> http://www.webreference.com/js/column34/methods.html
>
ok, i will

>>
>> Since you proposed to do this, for a piece of inline javascript in a
>> page template:
>> <<<<<
>> var CPS = {
>> }
>>
>> if (!CPS.document) { CPS.document = new Object() }
>> CPS.document.buttonClick = function () { ... }
>>
>> try google on javascript + namespaces
>> <<<<<<<<<
>>
>>  
>>
>
> that was just an example, all the implementations I have seen so far
> use the same pattern to create namespaces..
>
namespace can be composed of a traversal of variables, and instances of
class within those variables etc. i'll add a definition in the doc

>
>> What I meant (maybe not clearly enough i admit) by saying 'hey wait'
>> was: we have settled in CPSUtils
>> scriptaculous and prototype in order to gather into separated js
>> script file
>> cleaned and namespaced structures for all products, based on this
>> framework.
>>
>> Since in your lines, you didn't clearly mention scriptaculous/prototype,
>> i have reacted so people take the good habit to use what's available
>> in CPS
>> instead of looking up google like you haved proposed,
>> and doing something localy over a page template. 
>
>
> OK, then studying the pattern/layout used in prototype.js or
> scriptaculous is a good start.

yes, we need the same kind of layout, and that has been started in some
parts like cpsdefault and cpsdocument
but we don't need a CPS namespace, since we want each product to be
independant

> Now something that  was not discussed yet is how we would want
>
>> the form controller to be structured.  But nevertheless, you reacted on
>> my class example,
>> talking about memory leaks, and we went trolling :)
>>
>>  
>>
>
> well, since you did not have a clear object to attach your method to
> (like a CPSForm for instance created for one CPSDocument form), it
> appeared as though you had to instanciate your class just to get
> access to that clickButton() thingie.

nope, I was thinking of a form controller class where we would add this
method

>
> so yes, these should be classes, but the object must be designed first
> and instanciated in a controlled way (when the HTML form is loaded),
> not just when developer thinks "hey I need that clickButton() utility;
> I'll just instanciate that CPSForm class ..), and the code gets called
> every time the user moves the mouse.
>
that's exactly what i was saying, moreover, I'd like the developer to be
able to simply dig through what's available, and thats impossible if we
don't have clear js structures available.



Tarek

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to