Stack structure

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Spiff
Posts: 9
Joined: Fri Nov 04, 2011 10:27 am

Stack structure

Post by Spiff » Fri Nov 04, 2011 10:39 am

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?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Stack structure

Post by Klaus » Fri Nov 04, 2011 11:32 am

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

Spiff
Posts: 9
Joined: Fri Nov 04, 2011 10:27 am

Re: Stack structure

Post by Spiff » Fri Nov 04, 2011 1:16 pm

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?

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Stack structure

Post by Klaus » Fri Nov 04, 2011 1:26 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Stack structure

Post by dunbarx » Fri Nov 04, 2011 2:08 pm

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

Spiff
Posts: 9
Joined: Fri Nov 04, 2011 10:27 am

Re: Stack structure

Post by Spiff » Fri Nov 04, 2011 2:41 pm

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

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Stack structure

Post by townsend » Fri Nov 04, 2011 4:25 pm

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.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Stack structure

Post by jmburnod » Fri Nov 04, 2011 4:37 pm

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
https://alternatic.ch

Spiff
Posts: 9
Joined: Fri Nov 04, 2011 10:27 am

Re: Stack structure

Post by Spiff » Sat Nov 05, 2011 12:20 pm

Thank you, everyone, for your detailed comments.

Spiff

Post Reply