# If learning to code were like learning to write…

If learning to code were like learning to write, we’d start with words, first teaching children what a token is and how to read them. “Madison, look at that billboard, see the ‘if’? That’s a token in a lot of programming languages.” “Daniel, did you know that the numbers you practiced writing in kindergarten today are called ‘integers’? Python has integers too. They’re a sequence of digits. Want to go tokenize some digits while we shop at the farmers market?”

If learning to code were like learning to write, we’d move onto sentences, teaching children how to parse statements. “Look Madison, I brought you a new book from the library called ‘Python and other beasts’. Let’s read the first page: ‘print(‘ssssssss!’)’. Can you read those tokens? What kind of tokens are they? That’s right, an identifier, a parenthesis, a string, and another parenthesis. Together, they make a function call, which has a name, and a list of arguments. Good job!”

If learning to code were like learning to write, we’d next teach children how to read sentences, showing children how computers execute them. “Want to play computer Daniel? I got a new board game for us. It’s like the game Simon Says: you read a statement and you try to do what the computer is going to do. If you do it exactly like the computer does, you stay in the game, but if you do something different, you’re out. Check out this card, it says: ‘secret.index(“treasure”)’. Want to play?”

If learning to code were like learning to write, we’d next teach children how to read short books, giving them programs to read, exposing them to all of the computational possibilities of the language they were learning. “Madison, what did you choose for your book project this month? Oh, an Instagram post indexing algorithm, interesting! Are you liking it? What’s your favorite idiom?”

If learning to code were like learning to write, we’d ask children to start writing sentences, creating simple statements that accomplish small tasks. “Daniel, we keep forgetting to turn the light off in the garage. Can you log into the IoT portal and write a rule that turns it off every night at 9 pm?”

If learning to code were like learning to write, we’d then ask kids to write short essays, scaffolding their problem solving with design patterns for various genres of computational problems. “Okay, before you leave, let’s discuss your homework for this week: I want you to write a simple Python script that takes President Trump’s Twitter feed and finds all tweets that denigrate a person, place, or thing. I’ve provided the list of tweets that do this, so your job is to find an algorithm to do this automatically. This is classification problem, so the last two weeks of content should set you on a good path.”

If learning to code were like learning to write, kids would go to college and participate in writing workshops, doing code reviews with each other to improve their encapsulation, clarity, performance, and other software qualities. “Madison, I really like this abstraction here; its so simple, but you’ve managed to use it everywhere, reducing a lot of boilerplate and probably preventing a lot of defects. I bet if you added some polymorphism to this function you could simplify it even further”.

Unfortunately, with today’s computing education, learning to code is nothing like learning to write. Computer science never teach students about words. They give a few examples about grammar, but nothing comprehensive. They never teach students how to read, expecting them to pick it up independently. Then, on week two of intro CS, they immediately ask students to write whole essays. Its no wonder so many students are overwhelmed and drop out.

## 4 thoughts on “If learning to code were like learning to write…”

1. In order to know how something looks like you should know how this particular thing actually is. Coding appeared before the advent of writing natural languages. But there was this important structural evolution in writing that we were able to write down the spoken language, and then to make this script spoken language again. As a consequence, I believe that you are trying to compare different things. I understand that you are trying to say that we should approach coding in a holistic approach, and you are probably right, but I cannot really follow your writing style, except if this is If_learning_to_code_were_like_learning_to_write.py

• I’m definitely comparing different things; there’s no question about that. My goal was a provocative false analogy ðŸ™‚

• print “hahahaha”

2. You spent most of your time talking about children, and then all of a sudden, you talk about college. That’s a gap of about a decade between first childhood reading/writing to workshopping, a huge one. That missing decade is what is missing in computing education: the fact that it doesn’t start at age 5. How do you propose to fix this? And what analogies would you make with the difficulties of second language acquisition for adults?