AKMA's Random Thoughts

April 16, 2003

From the Grimy to the Delightful

It was a long, frustrating drive through Pennsylvania, twice stuck in long, long traffic jams — but Pippa’s happily off with her friend, Margaret and I are back with Juliet, and Juliet has wifi. I’d have driven from Akron to Princeton just to get a decent connection; last night the phone line kept dropping me offline after seventy seconds or so. Now I go to sleep. . . .

Posted by AKMA at April 16, 2003 10:59 PM | TrackBack
Comments

When Batman went home at the end of a night spent fighting crime, he put on a suit and tie and became Bruce Wayne. When Clark Kent saw a news story getting too hot, a phone booth hid his change into Superman. When you're programming, all the variables you juggle around are doing similar tricks as they present one face to you and a totally different one to the machine.

Posted by: Abacuck at January 12, 2004 09:37 PM

The Stack is just what it sounds like: a tower of things that starts at the bottom and builds upward as it goes. In our case, the things in the stack are called "Stack Frames" or just "frames". We start with one stack frame at the very bottom, and we build up from there.

Posted by: Jennette at January 12, 2004 09:37 PM

Earlier I mentioned that variables can live in two different places. We're going to examine these two places one at a time, and we're going to start on the more familiar ground, which is called the Stack. Understanding the stack helps us understand the way programs run, and also helps us understand scope a little better.

Posted by: Jordan at January 12, 2004 09:37 PM

When compared to the Stack, the Heap is a simple thing to understand. All the memory that's left over is "in the Heap" (excepting some special cases and some reserve). There is little structure, but in return for this freedom of movement you must create and destroy any boundaries you need. And it is always possible that the heap might simply not have enough space for you.

Posted by: Grace at January 13, 2004 10:46 AM

Let's see an example by converting our favoriteNumber variable from a stack variable to a heap variable. The first thing we'll do is find the project we've been working on and open it up in Project Builder. In the file, we'll start right at the top and work our way down. Under the line:

Posted by: Ellis at January 13, 2004 10:46 AM

Note the new asterisks whenever we reference favoriteNumber, except for that new line right before the return.

Posted by: Basil at January 13, 2004 10:46 AM