Learning How To Program

posted by on 29th April 2010, at 12:39am

The question I get asked most is: How can I start programming? This is such a broad yet important question as there are so many ways to answer it. Before I answer it I want to explain what programming is and why it’s something you may want to consider learning. At the very core programming is the equivalent of any spoken language. It has syntax, grammar, and stylistic rules. The only difference is that programming languages are used to tell a computer what to do. Learning how to program can be thought of as learning how to speak or write another language. You may want to pick up a programming language if you are interested in pursuing a career in computing science, wanting to write some quick applications for your computer, or if you are just curious about how all the applications you use are made. So now that you know what programming is, you may want to learn how to program. The first step is to choose a language; there are many languages, and I hope to help narrow your choice down to a few depending on where you want to go. After you pick a language you must learn it. The best way to do this is by programming using books/websites as reference materials. I will provide you with a template that can be used for learning any language. Finally, after you’ve mastered a language I’ll give you some pointers about where you should head next.

Choosing a language is important, if you choose the wrong one you may get turned off programming. If you choose a language that has too many oddities, such as C, you will have a hard time learning. This would most likely happen since C is a low level language, meaning it has few utilities to make it easy to use. If you choose a language that doesn’t apply to what you want to do, say choose Javascript when you want to learn how to make desktop applications, you will be wasting your time. If you’re looking to get into web programming exclusively, you should probably be looking at PHP being your first language. PHP is the language used on many websites (this one included) and is extremely powerful. If you want to just learn concepts of programming for web or desktop use you may want to consider Python. Python is great since it can be used on both the web and desktop. It also provides an intro to object-oriented (OO) programming which I’ll touch on later. Finally, if you are looking to head into a computing science program and perhaps software engineering there’s no doubt that you should be looking into Java. Java is a high level language (meaning it provides convenience features that are easy to use) that introduces object-oriented (OO) concepts from the beginning, Java also ensures you are programming correctly by being vigilant with syntax, and finally closely mirrors the C/C++ syntax. For the rest of this article we’re going to focus on Java but first I want to outline the general template to learning a language.

Learning a language requires a lot of practice. Practice typically helps you nail down the syntax and learn the quirks of the language. I remember while learning C++ as my first language (the AP high school program still used it for their exams) that I had trouble remembering the syntax, this is why practice is key. Here is an outline of the general process of learning a language:

  1. Select your resources for the language. This includes everything from websites that contain information on the syntax of the language, books, your text editor, and compiler.
  2. The next step should be to set up your programming environment. This should be relatively simple as we are just going for a learning and non-production environment.
  3. Begin programming introductory programs using your books and websites as a guide.
  4. Think of programs that you may find useful and implement them based on what you know.

Here are some introductory programs that you could implement:

  • Hello World – This is a classic program that nearly everyone writes when they first start learning a language. Its only purpose is to make you aware of the various output methods in the language.
  • Say Hello – This program will say Hello to the user in a nice way after asking for their name and then displaying the customized output.
  • Fahrenheit to Celsius converter – This program makes use of the previous two utilizing input and output. It brings in a new concept: mathematical operators.
  • Is a person young or old? – Use basic input techniques to get the users’ age and then tell them if they are old or young by using conditional operators.
  • The Change Machine – Request a decimal dollar amount. The program will then use a combination of output, operators, and conditionals to give the user their change in coin form.
  • Build a table of values – Using your favourite quadratic equation build a table of values. This program will use output and a new concept: counting repetition.
  • More Repetition (Post-Condition) – automate the previous fahrenheit to celsius conversion.
  • More Repetition (Pre-Condition) – automate the previous fahrenheit to celsius conversion.
  • Reduce Code Repetition for Interfaces – Easily repeat sections of code at different places to build interfaces using functions.
  • Reduce Code for Repetition for Calculations – Easily repeat calculations by using function

Now ideally you would head off to your editor and start implementing these basic projects. I am going to leave applying the template for Java until next month as that would greatly increase the length of this article. I believe that programming can be either difficult or easy and that ultimately practice makes perfect. With that being said if you don’t want to wait until next month, you can start implementing this template on your own. If you want to wait I will be back next month with a full implementation of this template with source code in Java.


This article is filed under Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Comments

  • Directxfire Says:
    29th April 2010, at 8:40pm

    Thanks. I’ve been thinking about giving programming a go and this helped me organize my thoughts a bit. I don’t know if you’ll even see this to respond, but is Alice any good?

  • Kyle3285 Says:
    3rd May 2010, at 7:48pm

    Thanks once again Shane, very useful 😀