Fog Creek Software
Discussion Board




How do you destroy an ingrown fear?

I have developed an allergy to all things pointy.

I studied pointers, and simply failed to understand them. There's no other way to put this, no matter what I tried, I couldn't get it.
Eventually I learned to work with pointers, even worked with C professionally but I still dread pointers. When I hear someone mention pointers or a project in C, I shudder, going back to those days when I failed to understand them and felt horrible for it.

This is not about learning the mechanics of pointers. This is about eliminating an internal fear. How do you go about doing that?

Ogami Itto
Thursday, August 12, 2004

Forget pointers, move into management.

*
Thursday, August 12, 2004

Learn assembly.

Just me (Sir to you)
Thursday, August 12, 2004

yeah, I know what you mean.
the answer is cliché as it is true: confront your fears

for example: i hated parking my car in between 2 cars. I hit one once and felt terrible about it, becuase it had cost me so much.

everytime I come driving by, looking for a parking place I tried to look for double-space parking spots, just to be save. that's quite annoying and it takes twice the time to find a spot (usually)

well, anyway...

someday i started to intentionally look for single-space spots, to overcome my internalfear. maybe retry to park 4 times in a row. now, i like and im good at it.

ok, i hope this makes sense :)

Guyon Morée
Thursday, August 12, 2004

I was good at assembly before I was exposed to C, I took to pointers like a duck to water.  The previous poster wasn't kidding, see if you can get a Z-80 emulator for a PC and learn a simple assembly language.

Snotnose
Thursday, August 12, 2004

i don't get your responses. didn't he say: This is not about learning the mechanics of pointers. This is about eliminating an internal fear. How do you go about doing that

Guyon Morée
Thursday, August 12, 2004

I hate parking garages and closed in stairwells.  Not the stairs, just the stairwells.

I've never had anything bad happen in either, but I hate them.  I'd rather park down the block than park in the garage.

But since there would be little gained by overcoming my parking garage fears, I don't even bother.

Also, I hate clowns.  Worst of all I hate clowns.  Very scary, worrisome creatures.  Damn their large ties and small cars.

hoser
Thursday, August 12, 2004

Sounds like my fear of carnies; small hands, smells like cabbage.

Austin
Thursday, August 12, 2004

If you are still fearfull then there is still something you don't understand or are still unsure about.  If you fully understood pointers there would be no fear.  You are still uncomfortable about some aspect of pointers, find out what that is and spend time thoroughly understanding it, then your fear will go away...

Chris Peacock
Thursday, August 12, 2004

Somewhere on JoS a teacher was asking for suggestion for teaching pointers.

I think they were going to use SPREADHSEETS.

Don't laugh.

I understand pointers b/c I used to do assembly programming in my early teens (yes, on the old Z-81 I think it was . TS1000 membrane keyboard computer. Ahh the joys of 2 K of RAM)

Spreadsheets have cell references that are absolute, relative and pointer-like. I.e., I can refer to a cell address located at $A$5  so $A$5 *contains* the address of the cell I want to use.

Or learn assembly.

Mr.Analogy (ISV owner)
Thursday, August 12, 2004

You were probably programming by trial and error, so your fear was the result of all the uncertainty.  Learn pointers properly, and you will only fear them when faced with maintaining pointer-heavy code written by another programmer who didn't understand them.

I'd also suggest learning Assembly.

NoName
Thursday, August 12, 2004

Don't learn assembly.  These people were not listening to what you wrote: "This is not about learning the mechanics of pointers."

You have a well founded fear of pointers.  They cause nightmares for high level app develpment.  Hence OOD. 

That doesn't mean you can't understand them (since reference types and all that are based on pointers).  But you don't have to clean them up, and think about them all the time, and put ***'s all over every piece of code hoping it doesn't dereference a null pointer.  Java and C# will deal with them for you and not let you screw up. 

However, if you are doing low level stuff, well, you're screwed. ;)

No Pointers here!
Thursday, August 12, 2004

Poiners are not necessary and are the sign of a low level hacker. Use references instead, they can do everything pointers can and do not come with the same baggage and poor style.

Tommy Bandolier
Thursday, August 12, 2004

> eliminating an internal fear

Here are two variants of ways to deal with it:
1) relaxation - since fear is a physiological reaction (your "shudders"), you lie down, get very relaxed, and then imagine the circumstance that gives you the willies. As soon as you start to tense up, consciously release the tension in your body, breathe deeply, etc. Lather, rinse, repeat. You're trying to break the association between the mental image and the old physiological response, and replace it with a new one.

2) a variation on an old Buddhist meditation technique -  again, lie down, conjure up the mental image, and really get into the sensations of fear. Focus entirely on experiencing every nuance of the willies. Rather, rinse, repeat.  Eventually the mind and body start going "ho-hum" (desensitization). Not for the faint of heart - the old monks used to do this sort of thing sitting in a charnel house to get over the fear of dying.

Either of the above might be worth a try.

Michael Ealem
Thursday, August 12, 2004

Rather -> Lather

sorry....

ME
Thursday, August 12, 2004

IMHO if you are serious working in this industry, you are going to have to put a lot of effort into learning pointers.  No matter what people tell you about modern languages, pointers are a fundamental concept in computer science.  They are not simply a way to weed people out of CS programs.

Languages that claim to not have pointers really just have a thin veil around them called references.  Any data structure other than vectors require pointers, and any language worth anything will support references of some sort.  If you pass an object to a function in Java you are using pointers.  You are potentially allowing multiple references to point the same object.  You can ignore this, but it will eventually get you into trouble. 

Pointers and references are simply a form of indirection.  Indirection is a key to high level abstractions.  So you are going to have to face your fears and learn about pointers.  If you have to, just draw out the memory structure.  Years ago as a CS tutor, I found few people who have failed to understand pointers after looking at a diagram. 

If pointers blow your mind, modern OSes actually have a hidden level of indirection as well.  Pointers don't actually point to physical memory.  They point to a virtual address.  The OS then uses yet another level of indirection to gain access to physical address.  Indirection is everywhere in this business.

baus.net
Thursday, August 12, 2004

"Also, I hate clowns.  Worst of all I hate clowns.  Very scary, worrisome creatures.  Damn their large ties and small cars. "

I think you misunderstand why clowns are so scary.

It's not the large ties and the small cars, it's the make-up.

They might be homicidally enraged, and you would never know, because they have that smile painted on their face covering their real expression.

Gustavo
Thursday, August 12, 2004

> spend time thoroughly understanding it, then your fear will go away...

Not necessarily. The physiological component might still be there, which is what I think the OP is referring to. He now understands pointers, but still gets the "willies."

Is that the case, Itto-san?

Miochael Ealem
Thursday, August 12, 2004

I've done some tutoring here and found if, for whatever reason, you're just not "getting" pointers ... to replace the word "pointer" with "backpack"

The analogy is simply that a backpack isn't anything except a 'container' for 'something'. From the 'backpack', you don't know what it contains and it could be empty (or contain another backpack, even in the case of multiple referencing (ie, COM)).

You can pass backpacks around, but you're always unsure of their contents and they have to be checked.

You can unpack the backpack, but you'd better be aware of what's in there (or you might be in for a surprise).

Help?

Anon
Thursday, August 12, 2004

Confront them fears. My dad was scared to death of getting on ladders and falling off them (mostly it was fear of falling). So I grew up thinking that being afraid of falling was normal.

My method of getting over this was, when traveling on business, get on glass elevators (there are a lot of them in Las Vegas). Stand facing out the windows, and go all the way down from the top floor. First trip or 2, I would hold the hand rail (wow, those knuckles are so white, folks need sunglasses to get in the same elevator). After that, I would stand with my hands behind my back. Eventually, I was able to ride the elevator down without locking my body into something of the order of rigor mortis (wow! you can pop this guy onto 2 saw horses and use him as a table!). Also, I used to ride rollercoasters and forced myself to relax (go limp like some treehugger at a nafta conference, err, I mean civil disobedience practitioner). I have yet to advance to the point where I can jump out of perfectly good airplanes.

Peter
Thursday, August 12, 2004

You mean your first program wasn't recursive hello world using pointers ?

#include<stdio.h>

void printHello(char* pcTemp)
{
  if(*pcTemp == '\0')
      return;
  else
  {
    printf("%c", *pcTemp);
    printHello(pcTemp+sizeof(char));
  }
  }

int main(void)
{
  char* pcHello="Hello World!";
  printHello(pcHello);
  return 0;
}      

I must have gone to the wrong university!
=)

Jon
Thursday, August 12, 2004

To all who replied:

Like I said, I understand the mechanic of pointers. I know all about indirection, enough to have sucessfully used it on the most demanding situation possible: a (several) professional project.
What happens is, I had such a terrible experience learning pointers, that until today when I realise they're going to cross my path I shrink in fear. If I dare to explore this a bit more, it's not the idea of pointers, just looking at the syntax ("*'s" and "*something->somethingelse") is enough to make me go "ooooooh, here they come again. Little Ogami is scared... :(".

What I want is to dissociate the frustration and fear from what for me is their visual representation, the C syntax.

Ogami Itto
Thursday, August 12, 2004

I used to be afraid of talking to beautiful women, and after facing my fears on several nights at clubs and bars...

...well...

...they still scare the crap out of me.

Kenny
Thursday, August 12, 2004

This is a serious response!

You might try hypnosis. There are standard techniques for phobia reduction.

It might be only one or two sessions (that is, less than $200).

You might want to look for a hypnotherapist who has some familiarity with the conputer industry.

Hypnosis helped me with fear of flying and an inability to speak up for myself in social situations. It works!

Big Improvement Experienced
Thursday, August 12, 2004

Here's the basic deal (I hope no one retorts with all sorts of confusing yabbuts, because I'm trying to demostrate *the basic deal*):

1. Memory is organized into bytes

2. Each byte is numbered

3. In order to modify a byte of memory you need to:
  a. Identify the number of the byte you want to modify.
  b. Identify the new value you want the store in the byte.

If you don't understand 1-3, repeat until you do.

Suppose you want to store the value 12 in byte #34.

Declare a pointer variable named "pmemory" to type unsigned char (byte) like this:

unsigned char* pmemory;

You need to load this variable with the value 34, which is how you indicate you want to modify byte #34.  You do that like this:

pmemory = 34;

Now you need to store the value 12 in byte #34.  You do that like this:

*pmemory = 12;

That's it. 

What tends to trip people up is the syntax.  Rather than "*pmemory" the language construct could be something like this:

move(34, 12);

Which would mean "move the value of 12 into byte 34" or it could be something like this:

move(pmemory, 12);

Which would mean "move the value of 12 into the memory location identified by the value of pmemory," so if pmemory is 34 the result would be the same as the previous move(34,12).

Assembly language uses a syntax like that (mov memory, byte), which is why I believe people find it easier to understand.

Now, in practice memory location values are usually much larger than 34, and they're usually expressed in hexadecimal, like C800B238.

$0.02

just a guy
Thursday, August 12, 2004

The original poster already clarified that he knows pointers, it is just the fear of it that is the problem.

There could have been a link between pointers to some feelings of inadequacy or past trauma entirely unrelated to pointers.

Solution:
You don't destroy the fear. Feel the fear, but do it anyway.

robtwister
Thursday, August 12, 2004

I had the same fear of pointers, and of arrays. You must conquer them. Guyon was right, go out of your way to use them.

Come on, they are really not that hard. Don't say you have tried but just can't understand them. Puh-lease, this is not like trying to run a sub10sec 100m. This is basic programming knowledge. Just do it.



(Nb on the subject of fears, I find elevators irky. Which I suppose it good for my health. On a good day at uni I take 20 flights of stairs throughout the day!!)

Aussie chick
Thursday, August 12, 2004

"I have developed an allergy to all things pointy."

Does that go for Pointy-Haired Bosses, as well?

Steve-O
Thursday, August 12, 2004

If you don't like pointers, you're a pathetic C or C++ developer. Change to working in a language that doesn't require them.

Mr Jack
Friday, August 13, 2004

Ogami,

make it easy on yourself. Each time you meet a new pointer experssion, add it to your "pointer cribsheet" (I hope I get this american lingo right, I mean a piece of paper (or a text file) in which you jot down stuff for easy reference).
On the cribsheet mark the expression using generic variable names on the left and an explanation of its constituants or meaning in a language you feel at ease with on the right.
After a short while you'll might find you very rarely encounter "new" expressons, and you can easily match all expressions to your comfortable expanation on the cribsheet.
You have replaced a job which requires some concentration in a stressfull situation with something that is more or les trivial and easily achieved even under stress.
You'll feel more confident, and over time less stressed, even to the point where you might not need this help anymore (but you can still feel confident it will be there when you need it).

Just me (Sir to you)
Friday, August 13, 2004

Anon,

what happens when you meet the backpack that contains itself?

Just me (Sir to you)
Friday, August 13, 2004

*  Recent Topics

*  Fog Creek Home