Globals in Modular Stack Framework
brahma at hindu.org
Sun Sep 1 10:48:21 EDT 2019
Given a modular stack framework for mobile, where
1) a "engine" stack to always open, but hidden on boot → call it "Stack Engine"
2) then you have multiple "modular" stacks -- call them views--which are opened and closed on "demand/navigation" → call them
a. stack "story"
b. stack "calendar"
c. stack "book"
Now, we know that globals are inherently "evil," but I find myself resorting to a global called
# with a growing number of keys,
# I know "s" is meant for local, it's a legacy thing
Now we have performance issues where, for a given view stack-- which may be open or closed:
a) we dig the a local data base for "stuff" like a set of quotes
b) are a series of image paths
The result of such a dbase/disk operations, is usually a "trivial" amount data... say a list of 50 images paths or 100 quotes amount to 20K.
It is small matter for the RAM to keep these lists in memory and not have to go "searching" again, so you have performance gain when you come back to say -- Stack "story"
There are two ways to go with this:
1) keep adding "keys" to the BIG global sConfigA
2) we could keep the custom properties of Stack Engine (which is always open)
Does anyone have experience and has come to "best practices" for this architecture? And why?
How does Levure handle this?
More information about the use-livecode