Teaching someone to code can, and is, a dubious thing to do. Indeed, as natural as it can seem to you, when you first start coding, the simple concept of a variable can be very hard to understand. To get a grip on how the conditional conditions work can be easy (
if/else ) but quickly becomes very hard, and can be harder if you choose a language which structure is far-fetch from English ( like Brainfuck, or Lisp ).
Currently, the academic way of teaching is really bad. Like bad beyond repair, at least in traditional curriculum ( They are new ways, like the 42 School in France, but the results are yet to be studied. ). The way teachers teach is a very simple look-and-repeat education, but it fails hard and doesn't make anyone good at coding, it just teaches them to write code. Ho, great, another code-monkey. Go get a job at Youtube, they have 500 errors.
If you ever tried to teach someone to code, most of the time, you will end up by writing code and asking the student to do the same. Or, you could also give him a challenge ( you can find a good list of those here : Projects ), but without knowing how to do it, the student won't be able to do anything if you don't show him how, which brings us back to our first problem.
We also need to keep in mind that we need to teach coding as a tool and not a end in itself. Back in time, people learned how to forge iron, or keep sheep, and now we learn to code because a lot of our day-to-day activities depend on it.
When I learned how to write, nobody told me that it was because I needed to become a writer, or a journalist. My parents taught me how to write and read because I need it everyday. Coding is the same, don't learn it because you want to become a rock-star-developer-ninja-wizard, although it might help. Learn to code because it opens you to a vast new field of possibilities and ways of thinking.
So, you will ask, how can i teach someone to code? Well, you can't. First off, you need to think about how you started coding. Was it because you learned in school, university or other? Was it because you needed to find a way to build your own application / website?
For me, it was very simple ; I needed to make a website promoting my Minecraft server. I started off using blogger, but all in all, it was a shitty experience because it didn't meet my needs and i depended on Google ( and i hate Google). So I went on the Internet looking for a way to make my own blogger and change everything about it. I was curious, so i started by setting up a tumblr and modifying the HTML. I didn't know HTML. So i learned HTML.
And I think it's curiosity and only curiosity which can bring us to learn a skill which we truly enjoy and in which we can be really efficient.
To teach someone how to code, don't show him how to code. Don't give him a challenge. Give him a solution, and a passion.
Give a man a fish, and he will eat for a day. Give a man a passion for the ocean, and he will live by it forever.