Which programming language is best to begin with as a total beginner?
I too would recommend Python as a friendly, accessible language without excessive syntactic sugar. While it looks very simple, it is not a toy language, it's a language used by Google, NASA, YouTube and many other places. It's quite powerful and flexible, and supports both imperative and Object Oriented programming paradigms.
Its syntax is straight to the point, and teaches you good habits in terms of formatting your code (unlike other languages, whitespace, ie indentation etc matters. So while you can write non-functional code, it'll always look nice :)
So, count me as a fan of Python. It's free, cross platform and can be used interactively. That means, you can open up a Python shell window and try out commands right there without having to edit a file and save and compile it. Python also comes with its own IDE named IDLE, it's not super-sophisticated like eclipse, but usable.
You may want to visit Python.org for more information, perhaps this Beginner's Guide to Python will be useful.
Just to provide a quick example to convey the flavor, here's how to print "Hello World" in C, Java and Python:
In C:
#include <stdio.h>
int main(void)
{
puts("Hello World");
return 0;
}
In Java:
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
In Python:
print("Hello World")
If you google, you'll find a lot of Python tutorials on-line.
Have fun with it!
Update:
My intention is not to start a "mine is better than yours" language war. The question was what language is good for beginners; My answer is (and stays) Python.
I already outlined the benefits above, there is much less conceptual baggage with Python (or Ruby for that matter). Beginners can focus on programming concepts, not extraneous matters. They can open a shell Python window and type in Python statements and observe the output immediately and interactively. Unlike C or Java, there is no need for separate steps of editing source files, compiling them and then running them early on, nor are explanations about "header files" in C, or the whole public static void main
incantation in Java needed :) Nor why we use puts()
or System.out.println()
when we really want/mean "print".
Simply take a look at the 3 examples above. Which code would be more easily understood by a beginner? Which language would you rather learn if you didn't know anything about programming? (Aside: Does taking out the return 0
in C make it really that much more comprehensible?)
If the question is what is the language to use for systems programming in Unix/Linux then I'd say C, and Java has its use too. Would C with its pointers and no-bounds checking on arrays and "manual" memory allocation and freeing be a good language for beginners? No, not in my opinion. Should a competent programmer know about these things? Yes, of course, in due time, after they master the fundamental concepts. We are taking about beginning programmers here.
Look at it this way: if you had someone who was trying to learn to drive a car, would you recommend a Ferrari to learn the basics?
There's a free book online by Chris Pine called Learn to Program which uses Ruby.
It begins assuming that you know nothing about programming and teaches from there. Even if you do know a little bit about programming, the first chapters build strong skills in Ruby, but don't feel repetitive.
Asking which programming language is best for a beginner is like asking which tool is best for a beginning plumber. It's completely irrelevant. The important thing is what you learn, not the language in which you express it.
If you're interested in programming in general and are serious about it, I would suggest you start reading through Structure and Interpretation of Computer Language. It's a little more complicated than your average "learn C++ in 7 days and become rich that easily...", but it is the shortest path to becoming a real programmer.
But this is far beyond the scope of the current website. The Stack Exchange network has other websites where this question may be relevant. To make things adequate, how about I assume you want to learn some Unix-related programming. I would recommend spending a few weeks learning C, then grabbing a copy of Advanced Programming in the Unix Environment, by Stevens. That should get you started.