You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Bilgin Ibryam <bi...@gmail.com> on 2010/04/04 15:10:04 UTC
Re: Use of internal direct variable access, or using accessor methods
Adam Heath wrote:
> ComparableRange has inconsistent access to the instance variables of
> other ComparableRanges. There are several methods that do some kind
> of comparison with another range. Sometimes, those methods call the
> accessor methods. Other times, direct variable access is used.
>
> Here's my take on this issue, based on the Concurrency in Practice
> book. If ComparableRange is final, and not meant to be extended, then
> always do direct access, period. If ComparableRange is supposed to be
> extended by other classes, then make the instance variables final(to
> force extended classes to use the accessors),
How can making an instance variable final force using accessors? Do you
mean private instead of final?
Bilgin
> then the base class
> always must use the accessors.
>
> Of course, this kind of design pattern needs to be imployed in the
> rest of the code too.
>
Re: Use of internal direct variable access, or using accessor methods
Posted by Adam Heath <do...@brainfood.com>.
Jacques Le Roux wrote:
> From: "Bilgin Ibryam" <bi...@gmail.com>
>> Adam Heath wrote:
>>> ComparableRange has inconsistent access to the instance variables of
>>> other ComparableRanges. There are several methods that do some kind
>>> of comparison with another range. Sometimes, those methods call the
>>> accessor methods. Other times, direct variable access is used.
>>>
>>> Here's my take on this issue, based on the Concurrency in Practice
>>> book. If ComparableRange is final, and not meant to be extended, then
>>> always do direct access, period. If ComparableRange is supposed to be
>>> extended by other classes, then make the instance variables final(to
>>> force extended classes to use the accessors),
>> How can making an instance variable final force using accessors? Do
>> you mean private instead of final?
>
> Yes certainly, since final would mean they will never change once
> assigned.
> Jacques
If the class is extensible, and a variable is final, but still might
need to be overridden, then it needs to be accessed thru a method.
>
>> Bilgin
>>
>>> then the base class
>>> always must use the accessors.
>>>
>>> Of course, this kind of design pattern needs to be imployed in the
>>> rest of the code too.
>>>
>>
>
Re: Use of internal direct variable access, or using accessor methods
Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Jacques Le Roux" <ja...@les7arts.com>
> From: "Bilgin Ibryam" <bi...@gmail.com>
>> Adam Heath wrote:
>>> ComparableRange has inconsistent access to the instance variables of
>>> other ComparableRanges. There are several methods that do some kind
>>> of comparison with another range. Sometimes, those methods call the
>>> accessor methods. Other times, direct variable access is used.
>>>
>>> Here's my take on this issue, based on the Concurrency in Practice
>>> book. If ComparableRange is final, and not meant to be extended, then
>>> always do direct access, period. If ComparableRange is supposed to be
>>> extended by other classes, then make the instance variables final(to
>>> force extended classes to use the accessors),
>> How can making an instance variable final force using accessors? Do you
>> mean private instead of final?
>
> Yes certainly, since final would mean they will never change once assigned.
> Jacques
Though I just thought that if the final is actually referencing an object, accessors may be used to get/set the value of the object
Jacques
>> Bilgin
>>
>>> then the base class
>>> always must use the accessors.
>>>
>>> Of course, this kind of design pattern needs to be imployed in the
>>> rest of the code too.
>>>
>>
>
Re: Use of internal direct variable access, or using accessor methods
Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Bilgin Ibryam" <bi...@gmail.com>
> Adam Heath wrote:
>> ComparableRange has inconsistent access to the instance variables of
>> other ComparableRanges. There are several methods that do some kind
>> of comparison with another range. Sometimes, those methods call the
>> accessor methods. Other times, direct variable access is used.
>>
>> Here's my take on this issue, based on the Concurrency in Practice
>> book. If ComparableRange is final, and not meant to be extended, then
>> always do direct access, period. If ComparableRange is supposed to be
>> extended by other classes, then make the instance variables final(to
>> force extended classes to use the accessors),
> How can making an instance variable final force using accessors? Do you
> mean private instead of final?
Yes certainly, since final would mean they will never change once assigned.
Jacques
> Bilgin
>
>> then the base class
>> always must use the accessors.
>>
>> Of course, this kind of design pattern needs to be imployed in the
>> rest of the code too.
>>
>