Roles of Variables

Denis Koroskin 2korden at gmail.com
Sat Oct 25 12:38:50 PDT 2008


On Sat, 25 Oct 2008 22:02:42 +0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Quoted from the article: "Roles of Variables and Learning to Program" by  
> Jorma Sajaniemi
> http://cs.joensuu.fi/~saja/var_roles/abstracts/didinf05.html
>
> Roles of variables in novice-level procedural programming:
> *Fixed value: A variable initialized without any calculation and not  
> changed thereafter
> *Stepper: A variable stepping through a systematic, predictable  
> succession of values
> *Follower: A variable that gets its new value always from the old value  
> of some other variable
> *Most-recent: A variable holding the latest value encountered in going  
> through a holder succession of values, or simply the latest value  
> obtained as input
> *Most-wanted: A variable holding the best or otherwise most appropriate  
> value holder encountered so far
> *Gatherer: A variable accumulating the effect of individual values
> *Transformation: A variable that always gets its new value with the same  
> calculation from values of other variables
> *One-way flag: A two-valued variable that cannot get its initial value  
> once its value has been changed
> *Temporary: A variable holding some value for a very short time only
> *Organizer: An array used for rearranging its elements
>
> I like that list. Even if it's not complete it covers many important  
> cases.
>
> The "Fixed value" case is so important that in Java the language gives  
> you an attribute to specify it. So if certain languages have an  
> attribute to specify the fist case, I ask myself if in a language it can  
> be useful to have attributes to specify other of those cases. I think  
> not...
>
> Bye,
> bearophile

Nice indeed!



More information about the Digitalmars-d mailing list