The best language for a novice to learn programming?

Is there such a thing as an ideal language with which to learn programming? Probably not.

Learning to program is a process whereby one learns, not only the syntax of a particular language, but also the constructs which form the basis of writing programs. In many respects, the language then helps to provide a conceptual foundation in programming. For example, a decision construct in the form of the if statement exists in nearly every programming language, and can be used to formulate the idea of decision making in an algorithm. Is there one particular language where the if stands out as being above all other if‘s? No, not really. There are some languages in which there are more side-effects, or have more idiosyncrasies that much is certainly true. For example C, has issues with the “dangling-else” in code of the form:

if (n > 0)
    if (a > b)
        c = a;
    c = b;

The else statement will be associated with the inner if statement, rather than the outer one, due to C’s association rules. To fix it would require embedding the inner if statement inside a block. Fortran, on the other hand, uses delimiters for its control structures. So the above code would be written as:

if (n > 0) then
    if (a > b) then
        c = a
    c = b

Even easier is Python, which uses indenting to specify association. Python also has the benefit of forcing the user to indent properly, a behaviour which can be easily transferred to other languages.

if n > 0:
    if a > b:
        c = a
    c = b

When learning to program the emphasis should be placed on the conceptual ideas: decision and repetitive structures, how to represent data, modularity etc. Too much emphasis on a languages specific syntax due to language oddities can detract from learning these concepts properly.

There is also the notion of transitioning from one language to another. Yes, learning C will help you transition to C++, or Java, but once you understand the basic concepts of programming, learning another language shouldn’t be that difficult. Lastly there is marketability – “knowing this language will help me get a job”. Actually, knowing an assortment of languages will better help you get a job.

So which language is the best for learning how to program? For the novice who is interested in learning the core programming concepts, the most learnable language is likely Python. Python allows for fast, efficient programming, and produces code which is imminently readable. It also has some features which make constructs easier to learn, for example passing information to and from functions (without C’s taxing use of pointers). It also allows for easy programming on devices such as the Raspberry Pi.

For the novice who is more scientifically inclined, then the language of choice might be something new like Julia. Julia allows for the simplicity of Python’s, without the slowness, and incorporates many constructs which make programming easier to learn, such as control structures terminated with the keyword end. Unlike C, Julia only offers two forms of loop, the for and while, and an if-elsif-else construct, as well as exception handling. Julia also has arrays whose indexing starts at 1 – YEAH, that’s what I’m talking about!

For the novice who is historically inclined, then Pascal is a good choice. Pascal does some things much nicer than many contemporary languages. One of those things is the difference between assignment and equality, which in Pascal are := and = respectively. Pascal was also designed as a teaching language, and has a somewhat English-like syntax.

Leave a Reply

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

You are commenting using your 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