The RR programming model

Rod McCall rodmc at runrev.com
Thu Nov 14 08:38:01 EST 2002


Hi Simon,

At 10:19 14/11/2002 +0000, you wrote:
>Hi
>
>I've vaguely flirted with Revolution and gone through a couple of 
>tutorials but I've never played with HyperCard or other stack based 
>systems - and I don't understand the programming model which they follow. 
>What is a stack? How do they fit in with more traditional programming 
>languages?

Sorry if you've already figured this out and it seems like I am talking 
down to you.... Also this is a brief overview and may miss out certain 
things, however it should get you started. If not please email me off list 
at rodmc at runrev.com

At the most basic level possible a program consists of a main stack. A main 
stack is simply a collection of cards (or windows) and as with nearly every 
other developer tool you can place objects (such as buttons) onto the 
cards. You can also write lines of code (known as scripts) which can be 
attached to stacks, cards or objects. Each card (or window) in the stack is 
in a specific order and you can navigate between them using either the card 
name or commands such as next or previous.  The metaphor is similar to 
having a deck of playing cards, i.e. you can pick specific cards or simply 
move through the deck of cards one at a time going back or forward.

You can also have substacks which are linked off the main stack, these are 
essentially just groups of related cards (or windows) which fulfill a 
specific purpose. For example say your program was an accounting package. 
You may have a mainstack which lets you access all the options (e.g. 
payments, receipts, invoices etc, etc).  This mainstack could contain 
substacks which handled specific items. For example one substack may 
contain only the options for invoicing (e.g. windows/cards, objects and 
scripts).

Now the next phase is messages. Essentially messages (e.g. an event when 
a  button is pressed) are passed up via a hierarchy. For example say I have 
a mainstack which contains one card and a button. If I press the button 
Revolution first checks if I have written the appropriate handler (e.g. 
mouseup) inside the script for the button, if not then it checks to see 
whether that handler is in the script for the card, if it is not in the 
card then it checks to see whether the handler is in the script for the 
mainstack.


><Yorkshire accent>
>When I were a lad, we sat down in front of green terminals bashing out 
>endless lines of C. None of your fancy object orientated rubbish, just 
>nice, clean hand crafted code. We had to trudge through the snow in bare 
>feet...
></Yorkshire accent>

You had it far too easy my boy! In my day we used binary and oscilloscopes 
for programming on monochrome NCR terminals powered by bicycles. If we were 
lucky we got to use assembler. However we were quite state of the art and 
some were still using punched card.

Programmers today have never had it so good :-)


>Seriously, can someone put the whole stack thing into some sort of 
>perspective wrt more traditional programming languages - or point me to a 
>resource which does this? I think it'd help me quite a lot.


Revolution has quite a different metaphor in comparison to most other 
languages I've come across but I hope you've managed to get something out 
of the description earlier. Here is a very brief summary:

MainStack = your program (contains substacks, cards, and objects).
         Card = A window and is part of a stack.
Substack = a group of related cards.

Cheers,

Rod



Rod McCall  <www.runrev.com>
Runtime Revolution Ltd
Revolution - The Solution for Software Development


tel: +44 (0) 870 747 1165 fax: +44 (0) 131 718 4334

All email subject to spam and virus checks. This may delay a response.




More information about the use-livecode mailing list