AKMA's Random Thoughts

October 19, 2003

On the Other Hand

Visitors to Digital Identity World may recall seeing the strained expression on my face as my trusty TiBook ran out of memory after a mere forty-five minutes or so of activity. I had ordered a new battery to be available Tuesday, before I left for Denver, but wouldn’t you know it — the battery delivery was late, and I had to fly away with only limited power.

I picked up the new battery yesterday, though, and I have to say that it feels intensely exhilarating to see the “time-remaining” estimate in the upper-right-hand corner hit three hours again, as in the olden days. Last year.

Posted by AKMA at October 19, 2003 10:59 PM | TrackBack
Comments

Let's take a moment to reexamine that. What we've done here is create two variables. The first variable is in the Heap, and we're storing data in it. That's the obvious one. But the second variable is a pointer to the first one, and it exists on the Stack. This variable is the one that's really called favoriteNumber, and it's the one we're working with. It is important to remember that there are now two parts to our simple variable, one of which exists in each world. This kind of division is common is C, but omnipresent in Cocoa. When you start making objects, Cocoa makes them all in the Heap because the Stack isn't big enough to hold them. In Cocoa, you deal with objects through pointers everywhere and are actually forbidden from dealing with them directly.

Posted by: Warham at January 13, 2004 12:39 AM

When the machine compiles your code, however, it does a little bit of translation. At run time, the computer sees nothing but 1s and 0s, which is all the computer ever sees: a continuous string of binary numbers that it can interpret in various ways.

Posted by: Margaret at January 13, 2004 12:40 AM

This code should compile and run just fine, and you should see no changes in how the program works. So why did we do all of that?

Posted by: Lettice at January 13, 2004 12:40 AM