January 06, 2003

Skid 6

an arrow
your teeth
gulls
magic formulas
(california)
philip glass music
edith bunker
she sad
we cope
then there is
another pink distress
in the crouton

"gone to crouton"
humming
a big city
of scars
nothing to loathe
about it, now
crawling on glass
but the feudal norms
of life
pull up, smoke
lambast government
though attentively persist

(you're
here
now
remembering
whereas
yesterday
no taxed language)
henry
kissinger (shea
stadium)
buy new york
before chile erupts

Posted by Brian Stefans at January 6, 2003 11:31 AM
Comments

These secret identities serve a variety of purposes, and they help us to understand how variables work. In this lesson, we'll be writing a little less code than we've done in previous articles, but we'll be taking a detailed look at how variables live and work.

Posted by: Dionisius at January 19, 2004 01:49 AM

That gives us a pretty good starting point to understand a lot more about variables, and that's what we'll be examining next lesson. Those new variable types I promised last lesson will finally make an appearance, and we'll examine a few concepts that we'll use to organize our data into more meaningful structures, a sort of precursor to the objects that Cocoa works with. And we'll delve a little bit more into the fun things we can do by looking at those ever-present bits in a few new ways.

Posted by: Benjamin at January 19, 2004 01:49 AM

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: Joos at January 19, 2004 01:50 AM

The rest of our conversion follows a similar vein. Instead of going through line by line, let's just compare end results: when the transition is complete, the code that used to read:

Posted by: Godfrey at January 19, 2004 01:50 AM

This variable is then used in various lines of code, holding values given it by variable assignments along the way. In the course of its life, a variable can hold any number of variables and be used in any number of different ways. This flexibility is built on the precept we just learned: a variable is really just a block of bits, and those bits can hold whatever data the program needs to remember. They can hold enough data to remember an integer from as low as -2,147,483,647 up to 2,147,483,647 (one less than plus or minus 2^31). They can remember one character of writing. They can keep a decimal number with a huge amount of precision and a giant range. They can hold a time accurate to the second in a range of centuries. A few bits is not to be scoffed at.

Posted by: Harman at January 19, 2004 01:50 AM