At 08:03 2002-11-20 +0000, you wrote:
> I was wondering if there is a way of passing variables
> between different forms? Or are globals the only
> solution?

Oh yeah, then you -could- use globals. This is the preferred method by many.
Some applications I have written have over 40 globals... *shudder* I find it
ironic that every computer programming course I take stresses the need for
-no- globals, while PalmOS philosophy is quite the opposite. Why is this?
Because Palm OS programming is much closer to embedded programming than traditional desktop or minicomputer programming. There is an OS there, but the OS is quite limited, and by using the C langauge as the primary API, the abstractions needed to handle things without "globals" aren't there.

However, its funny that even more abstract systems still have global variables, they just use other names. The singleton pattern in OOP languages is really a global variable use pattern. Static class members are really global variables, just with a limited namespace. Member variables of a class instance can be considered globals to that particular class instance.

The whole CS notion of avoid globals is a good rule of thumb, but its not gospel. The concept that they are trying to get across is well-define data dependency and to not have globally visible resources that can be used for multiple purposes in a system. It also encourages better design by avoiding hidden state -- having functions that depend on a variable not in their interface to control their behavior.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/


Reply via email to