Pointer Technology At A Glance

Pointer Technology At A Glance

Pointers Are Like Straight Pins

“This might be a little bit too delicate for the sewing machine,” a fashion student states.

“Ah, this is like the art of programming and when and where to use memory pointers,” I recall while thumbing through a fashion magazine.

Imagine yourself sewing a cocktail dress for the first time with only the pattern, fabric and directions to go on. Somewhere along the line, you figure out that the delicate areas are impossible to run under the sewing machine. So, you carefully quarter them off with trusty straight pins.

This is a lot like programming, because you mainly have calculations going on around in the background of your code, then bam! You hit some delicate areas that need to be reported either to the screen or on paper. That pointer is like a doorbell to a queue of information waiting to be printed or read on the screen.

It’s true that the pointer notation is needed in the background code itself, but the processes done to the data are often custom-written and it’s sole purpose is for an interactive presentation with an audience.

So like with straight pins, you might invest in keeping tabs on what needs to be hand-sewn, or in the case of pointers, what needs to be customized and appropriated memory to. Everything in your code should look seamless, but bear in mind that the background calculations (and there could be layers of them), have a purpose of helping to tabulate some of the delicate data that ultimately will have to be divulged to your audience.

Programming and Writing in General

My first training in computer programming languages came from Jet Propulsion Laboratory. Everywhere I looked, I could identify things that reminded me of my training there. Because I’ve been doing a lot of fiction writing, I’ve noticed that even symbols like ellipses remind me of computer programming.

There was a time when I saw data as products on a conveyor belt. Because the products looked round and white, they reminded me of ellipses in the English language. Catching up to date, currently in fiction I’ve been writing about robotic technology.

This part of my fiction-writing is still under wraps but I’m sharing it here to make a point about pointers. Melting rock formations is the basis for what will fuel robots in my science fiction stories. After these rock and stone formations have melted down, they are re-formed into swirly mini balls that look like marbles. They melt as they course through what one might call a ‘pin ball machine’ system of a typical robot.

In programming, these marbles will represent data and when product after product or data after data are flowing through, in one direction, in order to change directions, you might use a pointer.

It’s easy enough to increment or decrement and go from one data product to another, but when you have to change directions amidst the hard drive mapping, you might use a pointer to point to a different address.

Object-Oriented Graphics

I once had a wise computer programming college teacher who tried everything up his sleeve to get his students to warm up to the idea of object-oriented programming. Looking at groups of data as enclosed in a graphical rectangle (such as the title of an article in a Publisher newsletter as it was being written), was a completely different paradigm than from a few years back.

Back then, everything was iterative, you and therefore the computer (because you programmed it) interpreted commands line by line (executing each one in a sequential pattern). These days our point of focus, of as to what gets to be ran (or executed in the code), jumps around.

That wise teacher said, take a graphical interface program and work backwards. Draw some objects on the screen, like filling in a rectangular space with text, or a round object with a graphic, and then look at the code to see how it was generated by the computer. I took it one step further and pretended that each raw rectangle, square or circle were each numbered.

That way if the objects were layered and the #6 object were on top of a #3 object and it had transparent areas to it, parts of the #3 object (graphic) would peek through. However, if you put a #12 object under the #6 object, nothing would happen except traditional layering, because the value of the underlying (graphic) object underneath #6 has to be labeled (tagged) something less than the value of the number 6.

In all these shaped objects, they can be resized to make them bigger or smaller. Therefore, you still have to have the appropriate font size for text within them and the appropriate proportion sizes also for the graphics within them.

If you’re lucky enough to buy software that lets you work ‘backwards’ that would be great! You can re-size objects, layer them, even number them mentally in your mind to keep track of them. Then, look at the code that the software generated to see how your formatted template (such as a newsletter) was created!

Button In A Button (Inheritance in C++)

The subject of object-oriented programming has always sparked something within my imagination. You see the first novel I ever wrote, was in the science fiction genre and I used what I learned computer-wise in the private industry to fuel the computer advancements within the novel.

In C++, you can inherit a class object or your class object can take on the characteristics of another class object. Therefore, there is an “is-a” or a “has-a” relationship that is possible with each class object created.

Picture this then: A button within a button, within a button, within a button, and so on…

If the middle button makes the outer button related to it (and it can do so, in three different modes – private, public and protected), then, it only stands to reason, to go ahead and document that relationship. Depending on how their inheritance relationship was tagged, you will have to list down what is private data (variables and functions) to the outer button.

Now, if the innermost button inherits from the middle button, then it too will have rules of engagement not only from the middle button, but yes, from the outer most button too.

A private relationship, means that everything (variables and functions) are private to the class only. A protected tag means that that class is accessible to classes that have a protected relationship with it. Finally a public tag, means that that class is accessible from within the entire program code.

So if an Orange Button class (the color orange is made up of the primary colors red and yellow) inherits from a protected Red Button Class and a private Yellow Button class, then the Red Button class can share with it all of its’ public and protected parts. The Yellow Button class can share with it only its’ public parts.

Imagining the nested relationships as a button within a button was what got me started in writing this article, but you can also think of it as the three primary colors (red, blue and yellow) and all of the colors that descend (or inherit) from them.

The wise thing to do always, when you get stuck, is to document, document, document. That way, you will know the appropriate question to ask regarding your programming/coding predicament.

Pass the Buck

When I think of pointers in the object-oriented field of programming, I think of a virtual arrow, progressively pointing and traveling from its left to right path in computer memory. There have been other symbolic representations of pointers in my mind as well. I have also imagined a spotlight from high on top of the rafters de-referencing the character, numerical, or graphical values of those memory slots.

Well, it turns out, there are even more effective ways of understanding the directional volition of pointers as they rifle through a virtual array. Think of a pointer as a long envelope capable of carrying a letter representation of whatever is in the memory location, that it is hovering over. I think of it as beige in color and parchment in card stock and that, what are contained in the memory slots are business letterheads all ready to be printed out by the printer.

Let’s say our long envelope hovers over memory slot #5. The letter document gets added to the beige envelope, and if we want to daisy chain that to the document in slot #7, we would easily travel over and skip slot #6 (because we move in sequential line order), to access and de-reference the document in slot #7. With the slot #7 document appended, we go ahead and print out what were contained in Pointer Beige Envelope #1. Therefore, so it goes on, in the deconstruction stage when we empty what Envelope #1 is carrying, by setting it to NULL.

To wrap everything up, I thought if you think of a pointer as a dollar bill, that you pass succinctly from memory slot to memory slot, that is by far the most clearest explanation of a pointer of all. To literally ‘pass the buck’ is to have the dollar bill act like the virtual arrow or the stage spotlight up on top of the rafters. It’s even better than the beige parchment envelope that I just spent time explaining about.

However, if everything is to be understood in sequential order, then the envelope pointer theory did make its appearance before the ‘passing the buck theory.’

Database Design

For a fun sprint into the combination of a fashion scene and a database design, I wrote a short story about indexing database files using the color spectrum available in nail polishes. In my short story “Daily Diary,” a young girl by the name of Zoe emails a fashion magazine editor asking her how to “shop” for a high school fashion show that she was going to be graded on by the end of the school term.

The fashion editor’s name was Cassie and Cassie’s suggestion to Zoe was to pick a nail color and shop for fashion pieces that matched that particular color. For example if Zoe had initially picked out a darker tan color, then she might budget out her fashion show account, by purchasing a wide leather belt, that would hang loosely around her waistline.

Also, for a bubble gum pink nail polish color, Zoe might pick up a few different shades of a camp shirts in that tone of pink. Cassie also pointed out that eye glasses, with outlandish frames that were also that shade of pink should also be welcomed into her collection, that and a few colors of boas.

The database part will then be for Zoe to learn a little about the PHP programming language to build an online database, using the nail polish colors as the index colors to mix and match the fashion pieces.

The days from the movie “Clueless” weren’t that far off, when the lead character computerized her whole wardrobe selection methods.

With a database that has already filed pieces of clothing away by using nail polish colors as index values, you could literally ask for a “match” between the tan and blue nail polish colors and find some mix and matchable wardrobe combinations.

Argument Passing in Programming

In my experiences in the Computer Technology field, you can’t get away with having done a full day’s work without knowing a little about the steps taken in argument passing in programming.

Normally the name of the function, such as something fictitious as MakeWaffles would be assigned some dynamic values to take elsewhere and expand on. In this case, the complete line in Main would be NumberOfWaffles = MakeWaffles(MilkOunces, CupsOfFlour);

NumberOfWaffles would represent the exact number of waffles yet to be returned by the function MakeWaffles. A forecast of the output might look like this: NumberOfWaffles = MakeWaffles(.04, 2); This might return something like 15 waffles for the NumberOfWaffles.

Therefore, the full translation would be 15 waffles = MakeWaffles(0.4,2);

It’s been a while since I have stepped onto the Jet Propulsion Laboratory campus, but I can still remember sitting down and hashing out algorithms that eventually wound up similar statements that I have written up above.

There must have been some commitment on my part with regards to my job tasks, because I became fully ingrained in the rudiments of argument passing in the “C” programming language.