As programming becomes increasingly important, so does its pedagogy. Among the many resources out there that teach you to code, I've found Exercism.io to be the most effective. Exercism.io hosts a variety of programming exercises/problems for multiple programming languages.
"First, you download these exercises using a special software client, and once you’ve completed one, you upload it back to the site, where other coders from around the world will give you feedback. Then you can take what you’ve learned and try the exercise again."
These are reasons I really like it:
- It requires creativity
- It encourages failure and repetition
- It involves a community
Without going to much into it, the school system in which we are raised trains us to be afraid of failure. Consequently, we all try to get things perfect the first time. After all, you usually only get one shot to get an 'A'.
It turns out that that's the wrong way to teach programming because you never write a program perfectly the first time. Failure and repetition beget learning and mastery. I think Exercism.io does the best job of implementing this philosophy.
There is also a great article I encountered recently called "You may be picking the wrong programmers". It discusses the role of self-control in a programmer's success. It's a good read and it aligns well with the goals of Exercism.io.
My Experience with Exercism.io
The first exercise is called “bob”. You get a fun readme file to explains your objective. Here’s the intro to “bob”:
Bob is a lackadaisical teenager. In conversation, his responses are very limited. Bob answers 'Sure.' if you ask him a question. He answers 'Whoa, chill out!' if you yell at him. He says 'Fine. Be that way!' if you address him without actually saying anything. He answers 'Whatever.' to anything else.
Your job is to create a function that will respond appropriately to the prompts.
Here is my solution after a few revisions:
Now I upload this and others can make comments or suggestions. I can revise my code and submit it again. All iterations of my solution will be available to view on that exercise’s page, shown below.
Here is an example of how the community aspect can improve your learning experience.
In this exercise, the task was to “Write a program that, given a DNA strand, returns its RNA complement”. The first thing I thought of was a switch statement–it seemed obvious.
It wasn’t until after I submitted my solution that I encountered a different way of thinking about the problem. I browsed the solutions that other users had posted and noticed that one person chose to incorporate a map to “map” the DNA to RNA. This helped me remember that it is more important for your code to be conceptually clear than it is to be concise. I revised my code to reflect that attitude.
This is just one example of how the coding community can help you develop better code.