Sunday, February 15, 2015

Is "Learn to code by coding" a useful answer for someone asking how to code?

Earlier today I asked a question to some of my friends on Facebook the gist of which was "Which practices to you find useful in your pursuit of becoming a better programmer". I was asking about Code Katas in particular, but the question was quite general.

I think the way I phrased the question must have -- to people who don't know that I am a professional programmer -- suggested that I was asking how I could learn to program, rather than inquiring of my peers how they hone their craft.

Someone, who I assume interpreted my question as if I were a beginner, answered
"The best way to learn to code is to code. Deep end"
In one sense, this is very good advice. Those of us who are able to code generally learned how to do it through hundreds of hours of effort. This kind of advice resonates with those of us who have crossed that particular chasm -- we nod gravely and acknowledge that, indeed, there is no royal road to code.

But then I got thinking about how I would have taken this answer if I wasn't someone who has the experience to recognize just what is being expressed in this nugget of truth. What would I have
thought if someone had answered a genuine request for advice from a beginner with this succinct expression of what all of us programmers know to be true.

I think I would have been baffled. I think I would have been no better off than if I had received no answer at all, because to people without the shared experience of learning how to program, who haven't already spent the hundreds of hours required to grasp how to solve problems with computational solutions, this kind of answer carries very little information.

I'm not denying the truth of the statement, I'm denying it's usefulness if it stands without qualification.

What a beginner needs more than Nietzschean brevity is a clearer guide to getting started. I've taught several programming classes, and have mentored several juniors, and one thing is certain - learning to program is often an overwhelming prospect for people who haven't yet learned how. Beginners need examples, they need explanations through books and (good) lectures, they need people who can guide them in the practice of thinking like a programmer.
What is true, though, is that at every step of their learning one would want to include a very hefty portion of programming practice. A series of increasingly complex exercises and projects, for example.

Furthermore, even for experienced programmers saying that the best way to learn how to code is simply to code is misleading. One can spend several years solving the same kinds of programming tasks and not improve in any substantive way. So it's not true that simply coding is enough to become better once you've already got a basic competency in the discipline. What is required is some kind of deliberative practice along several dimensions as well as a steady dose of theory. And, to his credit, this is exactly the kind of thing the person quoted above suggested in a later comment once we had cleared up what I was asking.

To answer the question in the title: Yes, "Learn to code by coding" is indeed a useful piece of advice, but never simply left at that. For the beginner, it should itself act as a qualification "Read X,Y, and Z, but never forget that actually coding is the most important thing". For the more experienced "You should learn to code by coding in this way".

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.