July 18, 2014

Learning Projects

When learning a new programming language, and I've done this more than once, there are certain steps that I typically take in the process. I like to poke around the language web site and then read the getting started tutorials. If I like what I see and it fits my definition of an esoteric programming language, I'll install it and try my hand at some examples from the tutorials and the classic hello, world program.

These steps seem to be fairly normal for geeks like me and certainly the writing of a hello, world program is enshrined in programming lore and tradition. What is less clear is the recommended path to take after that. Some people complete tutorials, others buy books and work through them and then some dive in and work on a project so they can learn as they go. None of these are bad approaches, but I think that there needs to be something between working through tutorials or books and the big project for learning.

To this end, may I suggest the concept of Learning Projects? This involves writing a series of programs of increasing complexity that incrementally explore the capabilities of the language. I'm looking at replicating a select number of the traditional Unix tools, starting with the simpler ones and expanding from there.

In some ways this is an expanded view of the concept of Learning Tests. Learning tests are tests written by a programmer learning a specific language to help them understand the language they are learning. (I don't know who first coined the term, but I first heard it from Mike Clark.) There is nothing wrong with learning tests, but when approaching a wide number of languages, not all will have testing frameworks available and, most importantly in my view, the end result is not anything you can use or recycle components of after the learning effort.

Each of the programs in the Learning Projects are sequenced so that the programmer is learning at least one new capability of the language. These capabilities include writing to the standard output, return values, file handling, calculations, directory operations and system calls.

Now, allow me to present my suggested list of Learning Projects:

  • Hello World - This ensures that you can compile and run a program in the language and get standard output somewhere that you can find it.
  • true & false - Ensures that you can pass return values to the operating system.
  • echo - Requires you to process command-line arguments.
  • cat - Requires you to be able to read files and standard input.
  • wc - This requires handling multiple files, loops and arithmetic.
  • touch - Requires you to be able to create a file or update its timestamp.
  • cp - Ensures that you can read from and then write to files.
  • head & tail - Shows the ability to selectively read lines from files.
  • grep - Apply regular expressions to file contents.
  • strings - Shows the ability to selective read bytes from files.
  • od - Read from a file and apply fancy output formatting.
  • find - Recursive directory descent.
  • rm & rmdir - Be able to delete files and apply recursive deletion.

I believe that by the time a programmer has worked their way through this list of Learning Projects, they will be ready and well prepared to take on an interesting project for the purpose of more fully learning their programming language of choice.

Tags: Software