Learning Languages is Like Shopping at a New Grocery Store

Posted January 20th @ 10:16 am  |  Filed in: General Code    

A couple weeks ago I started taking a class down at the U of C called Dynamic Languages, taught by python guru David Beazley. Languages like Ruby, PHP, Python, JavaScript, Perl, etc. are dynamic in that they don’t have to be compiled in order to run, much like C and Java, which are static languages. In addition, you can do things like change variables from strings to integers and vice-versa on the fly, otherwise known as type-casting.

I’ve been programming mostly in PHP, and recently learning some Ruby. So imagine my surprise when our first assignment was to write a simple program in 9 different languages! However, this proved to be a very useful thing (after bashing my head on the desk for awhile).

First off, I didn’t realize how good I had it - working in static languages can be a royal pain. For example, in C, you have to declare your variable and what type of data they will hold, like this:

char c[30];  /* declare a char array */
FILE *file;  /* declare a FILE pointer  */
int i = 0;   /* declare an integer */
double total = 0;  /* declare a number with decimal points */

If you try to change any of those later:

i = "Matt" /* no longer a number */

You get an error when you try to compile it. And that’s another pain - recompiling every time just to insert a minor change. These dynamic languages were created in order to facilitate and speed up the development process and begin solving real problems right away.

However, I was glad I learned a bit of C (Java? not so much), as I didn’t realize just how closely many of these dynamic languages are related to it (and get this, C is written in C, I should’ve taken the blue pill…). Also, some of these dyno-languages have C-extensions, so you can take advantage of the speed enhancements that a compiled language offers.

But I digress - how is learning a new language like shopping in a new grocery store?

Every grocery store pretty much has the same stuff - the bread may be in isle 12 instead of 5, but once you find it, you’re good to go the next time you shop there. Programming languages have many of the same abilities, but sometimes there’s just a different volcabulary (and sometimes, it’s almost exactly the same - like in some of the C-influenced languages). Once you figure out where the stuff you usually shop for is, it’s downhill from there.

But the real fun about learning a new language is that sometimes you find that magic isle that has stuff you never knew about before. Ooooh, that coffee looks really good, and look at all this other stuff right next to it. I wonder if my old store had that stuff…

Much like that, learning a new language can help you understand things about the ones you already knew, but just never explored before.

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login

Options:

Size

Colors