O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a navegar o site, você aceita o uso de cookies. Leia nosso Contrato do Usuário e nossa Política de Privacidade.
O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a utilizar o site, você aceita o uso de cookies. Leia nossa Política de Privacidade e nosso Contrato do Usuário para obter mais detalhes.
First Do It By Hand
If you can’t do it by hand, you
can’t tell a computer how to do it.
Before doing any work on the
computer, get some sheets of
paper and a pencil. Choose an
example of your problem—not
too hard, but not trivial either.
Solve it by hand. The minutes
spent on this step will save you
by Cay Horstmann
Solve a Simpler
When you face a complex problem,
it is easy to get discouraged. A
great strategy is to solve a simpler
problem first. Ask yourself what
is the absolutely simplest part of
the task that is helpful for the end
result. Start from there. Then add
another feature, and another.
With some practice, you can
design a plan that builds
up a complete solution as
a manageable sequence of
intermediate steps. That way, you
will experience sweet success at
each step, and you will have the
energy to reach a final conclusion.
Use Physical Objects
Sometimes, you are given a problem
and have no idea how to solve it. You
may know that a loop is required, or
that you need to swap elements, but
that’s not enough to design a solution.
Try acting out your problem with
physical objects. Coins, playing cards,
scrabble tiles, or tin soldiers work great.
Suppose you need to arrange values in
a certain way. Try moving the objects
around until you discover a systematic
way that always achieves the correct
result. Then you are ready to write
pseudocode and code.
Try Some Code
Your textbook and the library
documentation can be confusing at times.
A quick way of making sense out of the
documentation is to try something out.
For example, suppose you suspect that
the “replace” function can be useful but
you don’t really know what it replaces
or how you can get the result. Make a
string, replace “i” with “x”, and watch what
happens. Many development environments
have a way of running quick experiments
without writing a full-fledged program.
Write More Code
Programming is not a spectator sport.
Understanding the concepts only gets
you so far. You need to have your hands
on the ball to gain experience. You can
start out with worked examples that
walk you through a solution, a step at
a time. Then set yourself a challenge
to push the example a bit further, and
implement your enhancement.
That way, you build upon something that
works, and you gain valuable experience
reading and writing code.