Page 1 of 1

Stack structure

Posted: Fri Nov 04, 2011 10:39 am
by Spiff
I am currently using Live Code to develop an historical project on 16th-century European history. When the project is completed, it will represent several hundred cards (at least 500, probably more) including pictures and sounds. The whole can be divided into chapters like a book. My question is this: is it preferable to develop everything in one stack, or divide the whole project into several stacks, or into substacks (e.g., religion, population, the army, etc.)? I am not quite sure I see the point of substacks vs. stacks. Are there any specific memory issues?

Re: Stack structure

Posted: Fri Nov 04, 2011 11:32 am
by Klaus
Hi Spiff,

LiveCode will load the COMPLETE stack (including substacks!) into memory,
so splitting your project into smaller pieces (separate stacks) is the way to go.


Best

Klaus

Re: Stack structure

Posted: Fri Nov 04, 2011 1:16 pm
by Spiff
Thank you for your answer. Do you recommend that when I start a new chapter I open a new mainstack or a new substack? Does that make any difference as to memory management?

Re: Stack structure

Posted: Fri Nov 04, 2011 1:26 pm
by Klaus
Hi Spiff,

I think I already answered your question:
LiveCode will load the COMPLETE stack (including substacks!) into memory,...
So, yes, new mainstacks are OK.

In the "Inspector" of these stacks check "destroystack" (Purge stack on close) and "destroywindow" (Purge window on close) if they are not checked!
This will remove these stacks completely from memory when they are closed.
If not, they will stay in memory until you quit!


Best

Klaus

Re: Stack structure

Posted: Fri Nov 04, 2011 2:08 pm
by dunbarx
I don't know, Klaus. I would do it in one stack, since it appears that all cards will be alike. 500 cards is nothing to LC. Why break chapters into separate stacks?

Craig

Re: Stack structure

Posted: Fri Nov 04, 2011 2:41 pm
by Spiff
Hello Klaus,

I note what you say on purging stacks while closing them.

I did read your comment on LiveCode loading the complete stack including substacks. When you say new mainstacks are "ok", are you saying they are equivalent to substacks? In terms of memory management or otherwise?

Spiff

Re: Stack structure

Posted: Fri Nov 04, 2011 4:25 pm
by townsend
Separate main stacks would require separate executables. That would be very awkward.
Why not go the extra mile and make this app efficient and good as it can be.

Create an Index card with a Tree or Grid, where the Cards would be organized. Ideally you'd have some kind of search feature where the user could search for keywords.

The cards contain three kinds of data: graphics, text, and audio. Put the graphics and text into a SQLite database. This way, the card is empty until loaded, and when it is loaded it is instantaneous, because only the data needed being read into the app. As for the audio files, organize those in folders as an external resource. This way they will play on all platforms. The path the the appropriate audio file would be stored in the database.

Also, instead of creating 500 Cards, create like 12 card templates. Depending on the content of the card, use the most appropriate template.

To design your DB schema, answer these questions.
What's the maximum # of text blocks, graphics, and audio files per card?
Also, add one extra field, Template, which would determine which card to use.

Re: Stack structure

Posted: Fri Nov 04, 2011 4:37 pm
by jmburnod
Hi,
Separate main stacks would require separate executables
No. You can have one standalone which open other stack, That work well
As for the audio files, organize those in folders as an external resource
Yes. That is a good way if you accept an a direct acces to the externall resources (everyone can change it)

best regards

Jean-marc

Re: Stack structure

Posted: Sat Nov 05, 2011 12:20 pm
by Spiff
Thank you, everyone, for your detailed comments.

Spiff