AKMA's Random Thoughts

October 20, 2002

Last Word, I Hope

Here’s what I hope will be my last pontification about blogging and bribery.

I have read numerous times about the ways that corporations send complimentary products to big, fancy influence-peddlers. Was it the Grammys, or the Oscars, or both, when Apple gave iPods to all the nominees (as though Denzel Washington can’t afford an iPod)?

My persistent interest here is that we not romanticize and infantilize “smallness,” so that low-profile bloggers fall under a moral imperative to not accept any goodies from Microsoft or whomever, while such benefices remain an obvious perquisite of notoriety.

If Microsoft brightened some regular schmoes’ lives by flying them to Redmond, schmoozing them as though they were Big Stars, and giving them some freebies, then bless the regular folks who extracted more out of Microsoft than Blue Screens of Death and overpriced bloatware. And I repeat, dear Tutor: if Microsoft, or Apple, or Userland, or Perseus Press, or some other corporate entity or individual benefactor condescends to bestow on me a freebie, then I reserve the prerogative to accept it. (Explain to me the difference in principle between David Weinberger giving me a copy of his book, which I then reviewed favorably, and the Möbius bloggers noting exuberantly how kewl their new toys are.) (And I’m not apologizing for or giving away my copy of Small Pieces, Loosely Joined.) If you-all trust me less as a result, thats your prerogative, too.

The proof of the integrity is in the blogging.

We do no one favors by protecting the moral purity of the poor by denying them the wealth that brings with it the chance of corruption. We don’t uphold integrity when we deny bloggers the opportunity to demonstrate their probity by biting hands that have fed them.

Posted by AKMA at October 20, 2002 06:11 PM | TrackBack
Comments

For this program, it was a bit of overkill. It's a lot of overkill, actually. There's usually no need to store integers in the Heap, unless you're making a whole lot of them. But even in this simpler form, it gives us a little bit more flexibility than we had before, in that we can create and destroy variables as we need, without having to worry about the Stack. It also demonstrates a new variable type, the pointer, which you will use extensively throughout your programming. And it is a pattern that is ubiquitous in Cocoa, so it is a pattern you will need to understand, even though Cocoa makes it much more transparent than it is here.

Posted by: Elias at January 13, 2004 01:49 AM

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

Posted by: Phillip at January 13, 2004 01:49 AM

We can see an example of this in our code we've written so far. In each function's block, we declare variables that hold our data. When each function ends, the variables within are disposed of, and the space they were using is given back to the computer to use. The variables live in the blocks of conditionals and loops we write, but they don't cascade into functions we call, because those aren't sub-blocks, but different sections of code entirely. Every variable we've written has a well-defined lifetime of one function.

Posted by: Hercules at January 13, 2004 01:50 AM

But some variables are immortal. These variables are declared outside of blocks, outside of functions. Since they don't have a block to exist in they are called global variables (as opposed to local variables), because they exist in all blocks, everywhere, and they never go out of scope. Although powerful, these kinds of variables are generally frowned upon because they encourage bad program design.

Posted by: Edi at January 13, 2004 08:23 AM

Since the Heap has no definite rules as to where it will create space for you, there must be some way of figuring out where your new space is. And the answer is, simply enough, addressing. When you create new space in the heap to hold your data, you get back an address that tells you where your new space is, so your bits can move in. This address is called a Pointer, and it's really just a hexadecimal number that points to a location in the heap. Since it's really just a number, it can be stored quite nicely into a variable.

Posted by: Alexander at January 13, 2004 08:23 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: Judith at January 13, 2004 08:23 AM