Learning a Programming Language

Learning a programming language is rewarding and easier than you might think. If you are new to programming and wish to learn, here are a few tips that help make the learning process more enjoyable and less daunting.


Programming languages are similar to spoken languages. Each has its own rules of syntax, vocabulary, and phrases. If you are a polyglot, then you will find computer languages remarkably similar to spoken languages. If not, please do not despair. Unlike many spoken languages, programming languages are logical and consistent. They make sense…most of the time.

1. Learn C

If time is limited and you can pick only one language to learn, learn C. Not C++, plain C. C is the Latin of programming languages that many of today’s modern programming languages are based upon. Just as a knowledge of the Latin language makes it easier to learn Romance languages, such as Spanish, French, and Portuguese, a knowledge of C makes it easier to pick up and learn newer C-based languages such as C++, C#, Java, JavaScript, and PHP. Programming syntax and concepts are similar, and even if you never learn another language, you can still create programs using C.

2. If Not C, Learn Python

“Python? Isn’t that a snake?”

If you are completely new to programming, C might seem overwhelming. The reason new languages exist today is because C is old and showing its age compared to the conveniences of modern languages. I would highly recommend learning Python because it is extremely easy to learn and use, and you can create fully functional programs quickly. In addition, Python source code is clean, uncluttered, and easy to read.

Python is the perfect newbie programming language, and it is well-supported. You can be up and running with Python far faster than you can with C, and you can write programs as complex as your imagination complete with GUIs (graphical user interfaces). The only real disadvantage with Python compared to C is that its syntax is completely different from that of C, so migrating from Python to a C-based language will require more relearning of what you already know.

Of course, if you have the luxury of learning two languages, learn both C and Python. The flexibility to read and write in multiple languages will expand your mind and improve your programming talent.

And, no. Python has nothing to do with snakes.

3. Become Knowledgeable in One Language

Focus on learning one language well rather than spreading your efforts across many. Devote yourself to learning one at a time, and learn the basics well.

4. Get a Book

Yes, you can learn everything you need to learn about a programming language from online sources, but I highly recommend purchasing a programming book designed for beginners. Nothing beats holding a book, and by learning from a book, you will become familiar with its contents so you can use it as a reference later. No matter how well you might know something, lesser-used concepts become foggy with time, and it will be faster to look up something in a book that you are familiar with than to search online through sites that change.

Programming books rarely become outdated, so purchase a used copy that is a few years old instead of the latest version. The latest versions usually contain extra material that only advanced programmers would use, so there is little need to invest the extra money for the latest version just to learn the fundamentals.

5. Start Programming Immediately

Learn programming by doing. Program along with the examples in the book to get a feel for the keyboard and to become familiar with the programming process and any resulting errors. Practice is essential no matter how simple.

6. Avoid an IDE At First

There are some great IDEs (Integrated Development Environments) available, such as NetBeans and Anjuta, that make your programming life easier. Unfortunately, they hide much of the under workings of the language you are learning. When first learning, compile and run your code from a terminal by typing commands. This will give you experience in its rawest form. As your programs become more complex, then gradually migrate to an IDE.

7. Learn the Vocabulary

Just like spoken languages, each programming language has its own vocabulary. These are called keywords, and knowing them is vital to writing an error-free program. The set is usually small, so these should be the first words you learn in your new language.

8. Become Familiar With the Reference Manual

Each language has its own reference manual that provides details about code you can add to yours. C uses functions. Python uses modules. Think of a reference manual as a cookbook. You could try to create a dessert of your own from scratch, or you could consult the cookbook and use someone else’s recipe in less time.

The same principle applies to programming. Rather than reinventing the wheel, you could use a recipe from the reference manual and move on to other parts of your program. This allows you to finish your program faster. Of course, if you are unaware that such a solution exists in the language’s reference manual, then you will waste time writing duplicate code. Becoming familiar with the reference manual gives you an idea of what is available.

This does not mean memorize every detail in the reference manual by heart because you will never use everything available and this would be a waste of time. Instead, here are a few steps that worked well for me when learning Python, though the same principles can be applied to any language:

  1. Pick one Python module a day
  2. Read through the module and learn what it does
  3. Copy each method onto scratch paper by hand. Writing as you learn helps reinforce the material in your memory. Write just the name, not the description. For example, if you read random.shuffle(), write random.shuffle() or just shuffle() if you can keep it straight in your mind that shuffle() belongs to the random module. This builds a list from which you can make flash cards if you choose.
  4. The next day, choose a new module to learn, but review yesterday’s module in the same way by copying functions and keywords onto paper by hand.
  5. Each day, add one new module to your vocabulary, but review all past modules quickly to refresh your memory. This helps you remember what you have learned while learning new material. After a few days, it will take too much time to review every single module, so rotate and limit the modules you review to, say, ten per day. Reviewing is important, but tackle it in small chunks for better long-term retention. Reviewing for 15 minutes each day is better than cramming for two hours on a weekend.

Again, do not memorize each module verbatim. Knowing what is available and what each does is plenty. You want to know what is available, not the details of its implementation. This way, if you encounter a situation where you need to shuffle the items in a list in Python, for example, you will know that random.shuffle() exists, and you can use that instead of spending time writing your own shuffle function.

Of course, if you need to write a custom function that shuffles, then that is a different matter. The point is that if you are not already aware of what is already present in the reference manual, then you may waste your time writing code that does the same thing as something that already exists.

9. Be Consistent

Different programmers have different styles of writing code. For example, some prefer to indent 4 spaces while others indent 3. Look at code examples in the book and experiment with ideas of your own, but settle on a style and stick with it for a program. If you line up braces a certain way, then make sure all of them are lined up in the same style for the entire program. This might seem like a trivial matter, but you will appreciate this consistency when reviewing your code months later.

10. Avoid Hacks

When learning a new language, avoid the desire to be clever and write cryptic code. Follow the book and learn the basics well. As your knowledge grows, your unique programming style will surface. One-liners and hacks are distracting in the beginning phases of programming. Strive for readable code, not cute code.

If a block of code is more readable across four lines, use that instead of cramming everything onto one line in a clever mess. Code you write will become fuzzy in your mind over time, and when you review it months later, you will appreciate yourself for writing clear, concise, readable code. Be nice to yourself.

11. Have Fun

The more you enjoy what you are learning, the easier learning becomes. Make programming fun for yourself! Give yourself timed challenges with what you have learned so far. Ask yourself, “What if I do this instead?” and then change your code and watch what happens when you run it. Think, “I have an idea for a text-based menu using double-lined borders. How can I accomplish it?” and then try to develop your own text-based menu.

Practice like this is invaluable. The biggest steps in learning come from the ideas you think of yourself, not from code examples in a book. If you can learn through your own programming inventions, then you will internalize the programming language faster and better than through book examples. This is the best way to learn.


These steps have always worked well for me and have helped me learn new programming languages quickly and efficiently. With review and practice, you can learn a language too.

Have fun!


  1. #1 by mortoray on March 14, 2012 - 5:30 AM

    “Avoid Hacks” Yes, indeed, but not just for programmers new to a langugage. You should always strive to do things in a clear, readable fashion. Mastery of a language is not measured in how much obscure syntax you know, but how well you can use and clearly present all syntax.

  2. #2 by anthonyvenable110 on April 21, 2012 - 6:16 AM

    This is great I look forward to the day that I have learned Python.

  3. #3 by delightlylinux on April 21, 2012 - 12:49 PM

    For anyone new to Python, I would recommend reading the Python Phrasebook by Brad Dayley to get started. This small paperback book covers useful Python basics and teaches by examples similar to the Linux Phrasebook.


  4. #4 by anthonyvenable110 on April 21, 2012 - 6:09 PM

    Reblogged this on anthonyvenable110 and commented:
    sounds like a great idea

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: