What should your first programming language be?

As a beginner who wants to dive into programming for the first time, one should consider a variety of factors before choosing one's first programming language.

Stability of the language

While there are so many programming languages to choose from, one should consider the history and stability of the language and its development environment.  Is the language fairly new and popular?  If it is still evolving, then it is possible that its language constructs may be refined and changed in its future versions.  Is the language portable?  Does it work on multiple platforms (Unix,Linux,Windows,Mac)?  Is it well supported with tutorials and documentation?

At the time of writing, the Python language has gained a lot of popularity in the past few years even though it was invented in the 1990's.  However, it has gone through many revisions and supports two different versions which are incompatible with each other.  Even though it has been marketed as an easy to learn language (including for children) its different versions (2.x and 3.x) might cause frustration for a beginner programmer.  This is because he will have to retrain himself in the difference in syntax, and features and possibly have to rewrite his programs that affect libraries that only support one version and not the other.

Application Scope of the language

Not all programming languages area created equal.   The Javascript programming language was born out of the necessity to program the Web.   Javascript was originally a language to program the Web from the client side.  In addition,  a Web programmer must also know HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets) to separate the decorations on a web page into external files.    HTML is a fairly simple language that is interpreted by a Web browser to display Web elements on a Web page.  HTML does not cover a traditional first programming language curriculum.  Javascript adds interactivity to Web programming.  Other languages that are used in the backend of a Web server to process interactive Web applications include CGI, Perl, Python, server-side Javascript, etc.

Web programming requires the novice to understand the concept of client-server programming, which might be an advanced concept for the very beginner.  This is usually introduced in a Master's program in computer science and not for the very beginner.

A more flexible choice of languages that is not tied to the Web would be C and Pascal.  C is a very powerful language that was written for the Unix(tm) operating system as well as a versatile language that is used in a multitude of applications from graphical user interfaces to financial applications.  C and Pascal were used in the 80's as the prime programming language of choice in colleges and universities.  One can write very simple applications (such as a calculator) to very complex and vast applications used in industry.

Procedural vs. Object oriented Programming

Procedural programming teaches the student to solve computer problems by dividing its solution into procedures or tasks.  It's akin to writing instructions for finding directions or a recipe.  It's a very natural process to the beginner.  Add to it the complexity of object oriented programming of abstract data types, polymorphism and inheritance, the beginner might give up altogether.  It is therefore advisable for the beginner to learn a procedural language such as Pascal or C as the first programming language.  This is despite the decisions made by many colleges and universities introducing students to C++ or Java as the first programming language.   C++ is an extension of the C language and is a more gradual approach to learning object oriented language after being confident in C as a procedural programming language.

Java borrows a lot of programming syntax from C and C++, however it is a harder language to learn for a beginner as it assumes the programmer already knows about object oriented concepts.

Many programming languages have been written to support object oriented features.  However, C++ is the only one that outweighs them all and is most efficient as it is 'C' with classes.  The programming syntax in C++ is more human readable than many of the other languages out there.  Java borrows heavily from C and C++, however it is also lacking in multiple inheritance and direct access to memory management.  The Java platform is rather complicated for the beginner -- JDK, JRE, Java SE, JVM, etc.  Other newer languages are so cryptic in their programming syntax that it makes them look more like machine languages rather than human-readable languages.

Compiled vs. Scripting Languages

Before there were compiled languages, there were assembly languages.  Assembly languages enable the programmer to program in a very low level dealing with computer registers and memory through simple but tedious instructions.  Then came along higher level languages that enable the programmer to communicate with the computer through a language that is more descriptive to humans.

A program written in a compiled language has to go through a series of processing before it can executed.  These processing stages are compiling and linking.  The compiler takes a source program written in a compiled language and produces an intermediate object code.  If the compiler does not detect any errors in the source program, it will then produce intermediate object code that is dependent on the machine.  The object code and optional libraries are then linked together by a linker to produce the final executable program, with the assumption that there are no linking errors.

For a beginner programmer, the majority of his time might be spent fixing compiler errors through correcting syntactical programming errors and eliminating warnings in his source program.  This is a very good way to learn the language.  However the compiler will not point out logic errors to the programmer.

Compiled languages include Basic, Fortran, Cobol, Pascal, C, C++, and Java.

Scripting languages were created to skip the editing, compiling and linking stages of a program and are executed directly as the code is written.  It is also considered a very high level programming language.  But really, the underlying application that a scripting language is written for is compiled to native machine code without the programmer's assistance.

There are many applications of scripting languages and some of them you might already be familiar with without your knowing it.  These include shell languages (Unix shells, Windows Dos shell), graphical user interface languages (Tcl, Tk), web server languages (Asp, Php, Javascript, Ruby), text processing languages (Perl, sed, awk).

Scripting languages are often themselves written in compiled languages such as C and C++.  If not, they are heavily influenced by C and/or C++.   As such, they usually provide support for interfacing with the underlying language that it is written in.  Ruby, Perl, Php, the Javascript engine and the Java Virtual Machine (JVM) are all written in C.  Python itself is written in C with C++ support.

Scripting languages are considered even higher level languages then compiled languages because they are written to control applications written in other compiled languages such as C and C++.   In addition, they are often written to reduce development time, thus, sacrificing processing speed and efficiency.   If your application is processing and memory intensive, you might want to consider writing your program in a more efficient compiled language such as C or C++.

Data Structure Support

Compiled languages such as C and C++ tend to support a wider variety of data types than scripting languages.  C and C++ are also system programming languages and as such they support data structures that manipulate memory to produce fast and efficient programs.  Java on the other hand does not allow the programmer to have direct access to memory management.  Many of the Java programs I have used are disappointingly slow.  Most of the scripting languages support simple data types and as such are not suitable for complex processing.  Scripting languages are also typeless, whereas compiled languages are heavily typed.


Choose your first programming language carefully.  It might influence the way you think about yourself as a programmer down the road.  My personal recommendation is to learn a language which supports a straightforward procedural programming paradigm (which is easy to understand), is stable (with no future revisions), has excellent support (available on most platforms), is versatile and whose applications are not limited in scope to a particular area (such as for the Web only) and whose features can be transferred to as many other languages you want to learn in the future.   In my humble opinion, the C language meets these criterion.  If you know C, along with additional computer science knowledge such as compilers and interpreters, you will have the tools to write your own new scripting language.  After you have confidence in C, I would also suggest that C++ would be an ideal choice for an object oriented language.



+3 #3 George 2009-11-17 18:00
I personally first learnt python as it teaches you a lot of the syntax for other languages AND it is very simple to just start programming
+3 #2 tb 2009-11-17 15:53
C is it. After that one can pick up whatever is "needed for the job" so to speak. Most other languages try to compensate for C's simplicity, abstract away a lot of stuff and some of them turn out to be cotton candy machines in disguise.
-3 #1 Mustang 2009-11-17 15:42
C then an OO one(anything will do) then Haskell then Prolog then Erlang. In that order.

Then you learn Java or .Net to be 'commercial'. Then your academic life will be over and you'll have lost faith in CS.