Oh, Sorry for misinformation:-)

But if you define this in members section, it will be added to
prototype, this is right, isn't it ? (So the prototype will be
polluted by these members)

2008/8/28 Derrell Lipman <[EMAIL PROTECTED]>:
> On Wed, Aug 27, 2008 at 4:06 PM, Petr Kobalíček <[EMAIL PROTECTED]>
> wrote:
>>
>> This code:
>>                      members : {
>>                                         _filterBar: undefined,
>>                                        _navigationBar: undefined,
>>                                          _table: undefined
>>                                         },
>>
>> Is bad. Never declare instance specific variables in 'members'
>> section. I members section is everything that's "shared" between all
>> instances and it's added to "prototype" of class. So use constructor
>> to initialize instance specific variables:
>> construct: function() {
>>                                        this._filterBar = undefined;
>>                                        this._navigationBar = undefined;
>>                                        this._table = undefined;
>> }
>
> No, as a general rule, doing this in the members: section is the correct
> place to do it.  The only time it causes a problem is when the member is
> initialized to an array or object.  In that case, each instance would get a
> reference to the same array or object, which is not typically what's
> desired.  For arrays or objects, you'd want to define it in the members
> section (and document it there for the API docs), but give it a value of
> null in the members section.  Then, in the constructor, assign the array or
> object for this instance of your object.
>
> Cheers,
>
> Derrell
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to