Coding to Learn

In recent years, there has been a movement towards teaching kids how to code. I wholeheartedly support this movement. However, I think there are benefits that come with coding that are not being stressed highly enough. Learning to program benefits your problem solving skills and helps you in math and science.

Solving problems is the heart and soul of programming. In order to overcome many challenges while coding, you must first fully understand the problem you are attempting to solve. A detailed understanding allows you to break the problem down logically into smaller, manageable sections, each of which can be translated to code. During the actual implementation, problem-solving is just as important. In order to perform tasks, you must determine how to combine small routines provided by the language into a larger pattern. There are always many ways to solve a problem when writing code, and this aspect of programming encourages collaboration to discuss the merits and shortcomings of different approaches. Unlike in math where the answer is an absolute and a solution will always be right or wrong, in programming, ten people can solve the same problem eleven different ways.

Writing code to help you solve problems in math and science inevitably confers a deeper understanding of the problem. For example, I could not remember the quadratic formula until I began writing a program to solve it for me. Breaking down the solution into small steps helps me understand how a process works, because I can see, as I write the code, how all the steps must be combined for the problem to be solved. Writing code to simulate problems in science allows for easy experimentation. The only resource needed to set up a digital experiment is time (and a computer). The virtual environment confers a freedom to play with ideas, break everything that can be broken and attempt the impossible.

If any of my arguments have persuaded you, here are some of my favorite programming languages and other assorted tools. For general purposes, I suggest the Ruby programming language. Its elegant syntax is easy to learn, but also allows for incredible sophistication. A good beginner tutorial is the interactive Try Ruby. A Ti83 or Ti84 calculator is often useful for high-school math, and they can be programmed using a language called TiBasic. If you are interested in creating visual simulations, I like the language Processing. To learn about programming physics with Processing, I suggest the excellent book The Nature of Code by Daniel Shiffman which is available online for free as well as in print. If you love math puzzles, I suggest Project Euler, a collection of problems meant to be solved with the help of code. If you want programming challenges to help you improve your code, look into Exercism, a series of problems in a variety of languages with a site that encourages you to give feedback to fellow programmers.

What are you waiting for? Start coding!