Saturday, March 30, 2013

First Programming Language

Lot's of people who are just starting out at programming or have just enrolled themselves in a Computer Science/Software Engineering degree have many questions about languages. There's just so many of them. For someone who's new to programming, it can be a lot to take in.

Most universities will teach Java or C++ for the most part, while bringing other languages into the mix as you get more comfortable programming. I volunteer at a local CoderDojo where we teach kids to code through weekly sessions. These kids are much younger than a lot of people starting out so we usually kick off by teaching them the fundamental elements of programming through Scratch, a great application developed at MIT. Eventually we allow the kids to branch off based on their interests, usually web or games.

In my opinion, beginners should pick a language that is well regarded and stick with that until they have a firm grasp on how to program. The language should be secondary, since your ultimate goal is to learn how to code, not learn a language. Of course the two can go hand-in-hand, but most people with a few years of experience programming will be very comfortable with multiple languages and lots of programmers hate to be constantly associated with just one of them.

My own advice to you if you are just starting out is to take a stab at learning to code in Python. It's very easy to read and can get you building interesting programs very quickly. Just for fun though, below is a comparison of "Hello, World!" (likely the first program you will write no matter what language you use) in some of the most popular languages for beginners. If you prefer one syntax over another, try that as your first language.

Java

public static void main(String[] args) {
    System.out.println("Hello, World!");
}


C++

#include <iostream>

int main() {
    cout << "Hello, World!" << endl
    return 0;
}


Python

print "Hello, World!"


Ruby

puts "Hello, World!"


C

#include <stdio.h>

main() {
    printf("Hello, World!");
}

There are plenty of others, but these are some of the most popular languages out there. If you take anything from this post, let it be what I'm about to say. Don't spend a great deal of time worrying about what language to learn first. They all have good parts and bad parts, but all of that is irrelevant if you don't know how to program at even the most basic level. So learn to program, then apply that knowledge to all future languages you want to use.

No comments:

Post a Comment