Clever Humans


Clever Humans do the darnedest things!


1 November 2007

Learning a New Programming Language

by Patrick

Eventually we all have to do it – programming languages wax and wane. One day you wake up and you are programming in Latin. All the cool kids have long since learned Italian.

Learning a new programming language isn’t always easy. Often it involves a paradigm shift (a paradigm is a unit of currency roughly equivalent to $.20 US) that changes some basic and fundamental concepts that you used to be surewere inviolate.

It doesn’t always even need to be a new language. For instance learning WPF(Windows Presentation Foundation) after having been a WinForms programmer for a number of years is a fundamentally different experience. Learning WPF is as difficult to learn as a completely new language and platform.

The new language may not be as good as the old. You might not be as productive in it. Certain things will undoubtedly be easier in the new language. Other things might even be more difficult. You might not like it aesthetically as much as the old language.

But, you know what? It doesn’t matter. This is the new language. All the cool kids are using it, and if you don’t want to be left behind you need to make the effort and learn it. And not just learn how to do it, but learn how to become good with it. Master the damned thing.

So here I present my sure fire method of mastery for any programming language. Note that it is task based and generic. With today’s new fad of DSLs (Domain Specific Languages) it is possible that your new language may not be able to accomplish some of the tasks below. It is possible that some of the tasks are trivially easy or ridiculously hard in the new language.

That’s fine. Replace these tasks with equivalent tasks of your own. Let me knowif you come up with any interesting ones.

From the list below, pick two beginner level tasks, two intermediate tasks and two advanced task.

The beginner level tasks are designed to be easy and to teach the rudiments of any programming language.

The intermediate tasks are slightly more difficult and often involve special techniques that will push you beyond your normal comfort zone.

The expert tasks should be hard to do in a language you are expert in. They use potentially uncommon techniques or techniques that are not normally accessible. Often their might be an easy way to accomplish this task. But in this case, and probably this case only, you will want to choose the harder way.

Beginner Tasks

1.  Rewrite Notepad.exe. Create an application that can open a text file, display it, allow it to be edited, and save it back to the file system.

2.  Rewrite Calc.exe. Create an application that adds, multiplies, subtracts, and divides numbers. Add more math functions if you wish.

3.  Transubstantiation. Create an application that can translate inputted numbers from Binary to Octal to Hex to Decimal, and all permutations thereof.

4.  Recreate an algorithm. Choose a quick sort, a binary search, a cyclic redundancy check, or a simple genetic algorithm in your new programming language. If the new language already has these things built in, do not use the built in versions.

Intermediate Tasks

1.  Simple PIM. Create a Personal Information Manager that will track contacts, random notes, and events. Make it pop up alerts when an event is scheduled if possible.

2.  Simple Defect Tracker. Every programmer ever has thought they could write a better bug tracker. So do it. Save defects to a database. Allow multiple people to log in. Allow a customizable defect workflow. Allow customizable fields on the defect form.

3.  Graphing Calculator. Expand your calc.exe from above to display a simple graph of a function.

4.  Simple Database. Create a simple, indexed, data store that allows you to store named record types to disk (or the equivalent) and to retrieve them back on demand. This could be an extension of the Recreate an Algorithm task from the beginner list.

5.  Design Patterns. Implement all of the GoF patterns in the new language.

Expert Tasks

1.  Syntax Highlighter. Parse your new language and redisplay the text nicely syntax highlighted. Of course, use your new language to do the parsing.

2.  Recreate MS Paint. Let the user draw and paint and save designs.

3.  Rewrite Task Manager. The windows task manager is a great and useful application. Recreate it using your new language. How cool would a web based task manager be?

4.  Simple Spreadsheet. Let users enter formulas (in your new language if possible!) in cells and automatically calculate the values. Perhaps extend your graphing calculator from the intermediate tasks.

tags: programming