Nathan Mynarcik wrote:
> Beno could use a Teddy Bear...
>
> Send it to him personally. Or perhaps some on this list can benefit from it
> again.
Ok. Here goes. If you've heard this before , no need to read further
(unless you're simply enamored of my writing style).
Hang on, Beno. I didn't mean you. You need to read this.
In one of my computer science classes, the prof had a big ol' Teddy
Bear sitting on a counter at the back of the classroom. Cute, cuddly
feller he was (the Teddy Bear, not the prof--he had serious ear hair
issues).
When we'd get stuck on a problem, if we went to the professor for
advice, he'd cut us off in short order. "Have you consulted the Teddy
Bear yet?"
So we'd trudge back to the back of the room, give the Teddy Bear a
tummy rub, and explain our problem, the approach we were taking, and
where/why it was failing.
A funny thing happened. Most of the time--I'd say 2/3 or more--the
answer would come to us while we were talking to the bear, and we'd
somewhat sheepishly go back to our seats, without needing to talk with
the prof.
The moral is that you have to understand your problem before you can
come up with a solution. Many, many times simply being able to explain
the problems is the most direct route to a solution.
So, beno, the next time you want to post a question to this forum,
talk to the Teddy Bear. If it doesn't solve your problem, it will at
least isolate it so you can send us a 5-10 line code snipped with a
clear description of your problem.
You should also get acquainted with a technique called "stubbing."
Often, you need to know several things about an object. Rather than
writing the whole program, then going back to figure out where you
went wrong, write the core of your program, and just stubs for other
methods or classes. These stubs will always return the value you want
because you hard-code them. They're just brain-dead little
burplets--you poke them, and they belch up the right answer.
As you get portions of the program working, you start replacing the
stubs with real code.
This is often called "iterative refinement," and is, to my mind one of
the central tenets of programming. I haven't seen a lot of evidence
that you're doing that with your code, at least what you're showing
us.
Incidentally, this iterative refinement concept works across
disciplines. When I'm practicing my French Horn, I use iterative
refinement to work out difficult passages. When I learned Chinese, I
didn't start by memorizing "Journey to the West." I started out
learning words and phrases, going over and over them to burn them into
my memory.
Beno, you actually do have an excellent resource here, and we will
respond very positively and helpfully when you post very specific
questions. It especially helps if you show what you've tried ("I did
this, and expected that, but got a null. Why?")
And, finally, I can't say this enough--learn to use the debugger. Live
in it. You should be spending at least 50% of your time in the
debugger--it will help you understand your own code a lot better. We
all do it--I'm not recommending a penance, but giving you a tip on how
the pros do it.
Cordially,
Kerry Thompsno
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders