Wednesday, December 29, 2010

New Year–>Learn a New Programming Language

One mantra of the The Pragmatic Programmer is to learn a new language every year.  As a new year is upon us, I thought I'd offer why we should do this and some practical ways to begin a new journey.

Why learn a new programming language?

As software developers, we solve many of the same types of problems day in and day out, typically with the same type of solutions.  Often times we don't know a better solution is out there.  Learning a new programming language teaches you diversity, seeing things in a different light, and offering you the opportunity of solving the same problem in a new, innovative way that wouldn't have been thought of otherwise. 

When we say learn a new language, this does not mean become an expert.  The goal of learning a new language goes beyond syntax, it goes to the heart of expression and learning different ways to solving the same problem.  One may find more efficient tools or concepts in another language that one could bring to the language of their choice; port some of these new concepts over to “your” language by beginning an open source project!

Where do you start?

Start by determining which programming language you want to learn.  If you don't know what programming language to learn, check out TIOBE Software.  They released a programming community index, this might give the gears of innovation a grind. 

I'm a .NET programmer by day but I’ve heard a lot about Ruby on Rails so my curiosity got the best of me and decided to go down that route.  It's amazing to me how advanced Ruby on Rails is compared to ASP.NET MVC (Yes, I know RoR came first).  The concepts of convention over configuration, gems, scaffolding, and database migrations popularized by Ruby on Rails are huge!

I would encourage you to pick something totally out of your comfort zone (not C# to VB.NET or vice versa, this doesn't count).  If you're a .NET programmer, trying something open source like Ruby; likewise, if you're a Java developer, try out some Microsoft technologies or other open source projects. 

Learning Resources

1. Koans - teaches you the syntax, structure, and some common functions and libraries through a "path of enlightenment" and testing in order to learn a new language.

My experience with working with Koans have been great!  It's a new, exciting way to work through the basics of a new language using tests.  I'd highly recommend giving them a try!

2.  Online Media (Blogs, Screencasts, Videos, etc.) - One of the many reasons I like the Development community is their openness to share what they've learned.  Take advantage of this community by searching for "How To" blogs or "101" blog entries or videos to learn your new language and then, most importantly, give back!  You'll discover issues you need to fix or new concepts you've learned, blog about it, contribute to a forum on that language.  Help others by giving back what you've learned!  It also serves as a great reference for yourself so you don't have to fight the same battle again.

Here are a few examples to start learning:

3.  Books - a more traditional way of learning a new language but is still effective (depending on the book).  With the age of e-books and multiple monitors, tutorial or step by step books are an ideal way to learn a new language and to gather some of the new concepts.  The Pragmatic Bookshelf publishes books that are very, pun intended, pragmatic.  They leave most of the theory and rhetoric out and focus on getting you coding as soon as possible.

Here are a couple examples:

  • Agile Web Development with Rails (4th Edition) - I'm currently reading/working through this book, it's a great example of writing a Rails app using Agile methodology.  It's another good example of a walk thru but has additional explanation as the author walks you thru building a shopping cart application.
  • Seven Languages in Seven Weeks - for those overachievers out there, pick up this book and begin a fast paced journey on learning 7 languages in 7 weeks!


Practice! Practice! Practice!

Often times learning a new language can be boring because we don’t have a particular problem to practice on.  We’ve learned the basic syntax but now we want to practice our new found knowledge and apply it to different sorts of problems. 

The following are examples to put your new found knowledge to use!  The key to working through the examples is to focus on the process, not the solution.  Focus on both syntax and the thought process behind it and, most importantly, focus on what you are learning through the process!  This is how we develop diversity!!

1.  Code KataDave Thomas has written a number of problems  that are worth trying.  Some examples include word chains, Klondike, and anagrams.

2.  Ruby Quiz – this site has sample quizzes based on, you got it, Ruby.  There are also suggested solutions that are implemented in Ruby.  However, this can be easily adapted with whatever language you are learning.  Examples include Paper Rock Scissors, Numeric Maze, and Dice Roller.   Remember, it’s the process, not the solution that counts!

3.  Project Euler – these are primarily mathematical/computer programming problems.



  • Learning a new language is fun but can be frustrating at times.  I’d encourage you to time box some of these learning activities.  Use the Pomodoro Technique where you practice for 25 minutes, then take 5 minutes off.  There are many apps out there that can help facilitate this.
  • Start small!  Don’t expect you can write a huge complex application out of the gate.  Realize that learning is a process and needs to be practiced!
  • Don’t focus on just learning the new syntax.  Immerse yourself in the new thought process of the new language.
  • Teach your new found knowledge with other developers who will listen!  If no one will listen, and even if they do, blog about your experience!

I hope that with the coming new year, you'll add one more New Year's Resolution (except you’ll keep this one): learn a new programming language!  It will pay back in ways you've never thought before!