toring others, it is vital to be curious.
Many paths exist to arrive at some
knowledge, and your own intrinsic
views are not always the best for everybody. When learning, people want
to relate new knowledge to existing
knowledge; this gives them a strong
foundation upon which to build. Curiosity is about being open to ideas, solutions, and methods of thinking that do
not necessarily reflect your own views.
You must teach from the perspective of
those you wish to educate.
A General Approach to Debugging
Through continued learning, malleable views of problems, and effective use of tools, you can become successful in debugging. Still, some insist
that debugging is more of an art than
a science. I think we can dispatch this
idea entirely. It is clear that debugging
requires learning, and the scientific
method is specifically designed to yield
new knowledge. The method, summarized: ( 1) Develop a general theory of
the problem. ( 2) Ask questions leading
to a hypothesis. ( 3) Form a hypothesis.
( 4) Gather and test data against the hypothesis. ( 5) Repeat.
In my experience, very little attention is paid to the formation of a hypothesis, resulting in a wasted effort,
testing without any theory pertaining
to the cause of the bug. Forming a good
hypothesis is rather more difficult than
it would seem. In practice, hypotheses
are poorly formed, and many rely more
on intuition than information gathering. Intuition can be an effective strategy for debugging but requires extensive experience and, when used as the
only strategy, leaves the programmer
unprepared to handle new, unfamiliar
bugs. Lacking a framework for solving
these bugs is particularly damaging for
entity theorists.
A good hypothesis describes a problem and is both testable and falsifiable.
In fact, forming a proper hypothesis almost always implies that a bug is fully
understood. Consider the following
three statements:
˲ A bug exists in the logging module.
˲ A race condition exists in the logging module when concurrent log producers enqueue the same item.
˲ A race condition between concur-
rent log producers consuming pooled
work objects is caused by an improper-
sistent feedback may simply be a func-
tional equivalent.
Most examples of such feedback fall
into framing information in a way that
promotes growth-oriented goals. When
a colleague solves a particularly nasty
bug, people tend to say, “You’re brilliant!” Instead they should say, “Great
job on the hard work!” If you task engineers with work that is very easy for
them to solve, you can be apologetic:
“I’m sorry for assigning you a task you
couldn’t learn much from.” Try to direct more challenging work to those
colleagues in the future. Students and
individuals will face frustration when
solving bugs. If you, your students, or
your colleagues voice frustration, try
to frame it in terms of what you or they
can expect to learn upon completing
the project.
Unfortunately, students and job
candidates are generally not able to
choose teachers or managers who
hold such views. Because learning is
best achieved when both students and
teachers hold incremental theories,
14
it is crucial that organizations hire individuals possessing such views and
train existing staff on the material.
Instructors and tutors possessing an
entity theory are more likely to focus on
helping only those they perceive to be
the brightest, writing off the struggling
students as lost causes. This is particularly unfortunate since in several studies, Dweck shows that underachieving
students with a malleable mindset
moving into harder problems (as happens in transitions from elementary
school to middle school, or from high
school to college) tend to outperform
high-achieving students with an entity
theory. Instructors with an entity theory are less likely to help the underper-forming students succeed.
Reinforcing Incremental
Theories for Individuals
Education is a lifelong process. As individuals, we should adopt malleable
views of intelligence in daily life. There
are specific ways of approaching problems that develop and reinforce a malleable view of intelligence.
Active recall. One way people may
force themselves into entity-frame-work thinking is an overreliance on reference manuals and documentation.
Are the arguments to memcpy in the
order of source, destination, length; or
are they destination, source, length?
Is strstr haystack, needle; or is it
needle, haystack? Many individuals de-
velop a habit of consulting references
(such as system manuals) as soon as
the question comes up.
Active recall is a study method in
which you first make a guess before
looking up the solution. (This is the
basis upon which study tools like flash
cards are built, but it must be employed properly to be effective.) In the
case of interfaces such as memcpy and
strstr, write the code first: take your
best guess at the argument ordering.
Once you have done this, look at the
reference manual to confirm whether
you have done it correctly.
Segmented study. Think of the last
time you spent an entire day on a marathon debugging session. Did you solve
the problem? Or did you need to take a
break and work on something else for
a bit, perhaps going home, sleeping,
then solving the problem the next day?
Engineers frequently engage in sunk-cost fallacies while debugging, expending additional effort solving a problem
despite diminishing returns for the
time spent. Our brains are not tuned
to focus on specific tasks for hours on
end. Segmented study is the idea of having one or two additional and unrelated
tasks to switch to over the course of an
activity. Switching gears and taking
breaks are (perhaps counterintuitively)
effective methods for making progress
when you are stuck.
For managers, mentors, and educators, this is also true. Explicitly allow colleagues and students time to
work on other problems. Students
and employees will not usually ask to
work on something else, so it is crucial to grant folks the time they need
to process information.
Persevere. What segmented study
doesn’t mean is giving up when things
get difficult. You must persevere: tenacity and passion are at least as important as intelligence to both success
and skill development. The most successful individuals in a field practice
their craft for years at the edge of their
ability. This “grit” is highly correlated
with individual success factors.
4
Be curious. With sufficient experience, it becomes appropriate to mentor others. When teaching and men-