Roles of Variables
Robert Fraser
fraserofthenight at gmail.com
Sat Oct 25 16:41:58 PDT 2008
bearophile 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
I'm sure that list is being used in some CS 101 class and the tests all
have "label the type of each variable". The day the test is returned
there will then be 100 unhappy students arguing that every variable can
fall into multiple categories.
More information about the Digitalmars-d
mailing list