[Opengeoscience-developers] vgl protected work

Ben Burnett benbu at nyu.edu
Fri Oct 4 15:36:00 EDT 2013


Using accessor methods is a bit of an overhead, but gives us the ability to
do custom operations when variables are set/accessed (e.g. validation), and
doesn't remove functionality.


On Fri, Oct 4, 2013 at 3:15 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> I see. Which is what we have.
>
> So basically you prefer what we have. Any strong supporting arguments?
> Related to this is using privileged methods
>
> this.foo = function() {
> }
>
> or public methods
> classA.prototype.foo = function()
> {
> };
>
> I am not big fan of prototype methods but there is some good arguments
> about using it.
>
> - Aashish
>
>
>
> On Fri, Oct 4, 2013 at 2:20 PM, Ben Burnett <benbu at nyu.edu> wrote:
>
>> I think it's fine the way it is, and we can just add access methods to
>> private variables that need to be used in subclasses. e.g.
>>
>>
>> var classA = fuunction() {
>>   /** @priate */
>>   var m_foo = 10;
>>
>>    this.getFoo = function(){ return m_foo; };
>>   this.setFoo = function(foo) { m_foo = foo; };
>> };
>>
>>
>>
>>  On Fri, Oct 4, 2013 at 1:15 PM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>>
>>>  Folks,
>>>
>>> I am thinking of dropping that idea. After reading quite a bit I am
>>> convinced that its probably better not use to private variables. Just
>>> having a m_ prefix should tell developers that it is private and not be
>>> used like a public variable.
>>>
>>> So if we had
>>>
>>> var classA = fuunction() {
>>>   /** @priate */
>>>   var m_foo = 10;
>>> };
>>>
>>> Now it will be
>>>
>>> var classA = function() {
>>>     /** @priate */
>>>     this.m_foo = 10;
>>> };
>>>
>>> With this change, the derived classes should be able to take advantage
>>> of it as for them it would be
>>> ok to call this.m_foo directly.
>>>
>>> I am very much interesting in hearing your thoughts on it. So please
>>> reply to this email asap.
>>>
>>> Thanks,
>>>
>>>
>>> --
>>> | Aashish Chaudhary
>>> | R&D Engineer
>>> | Kitware Inc.
>>> | www.kitware.com
>>>
>>> _______________________________________________
>>> Opengeoscience-developers mailing list
>>> Opengeoscience-developers at public.kitware.com
>>>
>>> http://public.kitware.com/cgi-bin/mailman/listinfo/opengeoscience-developers
>>>
>>>
>>
>
>
> --
> | Aashish Chaudhary
> | R&D Engineer
> | Kitware Inc.
> | www.kitware.com
>
> _______________________________________________
> Opengeoscience-developers mailing list
> Opengeoscience-developers at public.kitware.com
>
> http://public.kitware.com/cgi-bin/mailman/listinfo/opengeoscience-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/opengeoscience-developers/attachments/20131004/790f683a/attachment.html>


More information about the Opengeoscience-developers mailing list