Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Ok here is the deal after playing with Linux distros for best part of 4 years, I have a great urge learn some coding. However I'm a bit undecided as to which programming language to begin with. Word around is Python but is it the right choice for a guy with limited knowledge in QBASIC?

If it is not too much, a link to some great noob tutorials on the suggested language will be greatly appreciated. Thanks in advance

share|improve this question

closed as not constructive by Gilles, Kevin, jasonwryan, Michael Mrozek Jun 22 '12 at 6:45

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
See also What is the easiest language to start with? –  Marco Jun 21 '12 at 18:23
    
What's your goal? Do you want to be able write some scripts or do you want to start programming? –  lukas Jun 21 '12 at 22:16
    
If limited knowledge in QBasic is in any kind limiting for your decision, maybe you should learn QBasic? Perhaps to the full, and then learn something else completely. –  user unknown Jun 21 '12 at 22:43
4  
Voted to close as per Why is "what language should I learn" considered off-topic? . Two out of four doesn't make the question any more constructive. It depends what you want to do. –  Gilles Jun 21 '12 at 23:30
1  
@Marco: Easiest != Best. –  DevSolar Jun 22 '12 at 6:47
add comment

11 Answers 11

up vote 20 down vote accepted

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 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?

share|improve this answer
1  
Python is where I started my 9 year old son. +1 –  Tim Jun 21 '12 at 19:20
1  
+1 for python. swaroopch.org/notes/Python is a good tutorial. –  Juan Francisco Cantero Hurtado Jun 21 '12 at 21:09
2  
Your comparison is very biased. The C-Example, can be reduced to int main () { puts ("Hello World"); } and on the other hand, I have seen python-code with ` __main__` -boilerplate too. –  user unknown Jun 21 '12 at 22:48
1  
@userunknown Those are standard constructs for the language without any any sort of bloat or artificial inflation. Notice the return type of main in C is int,so it should have a return, a value of 0 meaning the program terminated normally. So, yes, you can "optimize" programs by leaving out things, or putting it all on one line, but that doesn't make them any less complex. Is your final argument that one can write poor programs in Python? Well, yes of course .. you can do that in any language! My point is Python's syntax is simple and w/o much of the extra things needed in others. –  Levon Jun 21 '12 at 23:01
2  
@userunknown Your optimized C code left out the header file .. I suppose that's optional too. Also, at least gcc 4.4.3 doesn't return 0 in its default setting without a return 0. Having to use compiler switches etc is fine, but why burden beginners with that? They have enough other things to worry about. Your "tricks" and rules to optimize introduce all this extraneous stuff beginners shouldn't have to worry about. No one is putting down C or Java, the question is what is a good language for beginners to learn programming. –  Levon Jun 22 '12 at 1:08
show 10 more comments

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.

share|improve this answer
add comment

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.

share|improve this answer
3  
I would disagree about the choice of language being "irrelevant", just especially since we are talking about beginners. For them, you want them to be able to focus on the main concepts and not worry about all the various syntactic requirements. Of course every language has those, but as my 3 examples in my answer showed, Python (and Ruby too) keep them to a minimum. Explain to someone why if they want to print something they can't simply say print 'something', but instead have to learn about public class .... etc. :-) –  Levon Jun 21 '12 at 19:52
1  
.. and tossing in the Stevens book (great book for experienced programmers) with the comment "that should get you started" for someone who describes themselves as "limited knowledge in QBASIC" is simply too much conceptual stuff to swallow. C and pointers and memory management ... If it sounds as if I have definite/strong opinions on this, it is because I do :) It's part of my job to think about exactly these sort of things. [ok, I'll get off my soapbox .. we now resume our regularly scheduled program] –  Levon Jun 21 '12 at 20:10
    
C syntax may be repelling at first, but it also does an incredible job of correctly representing the underlying machine. But most importantly I still maintain that it's irrelevant. Learning to program is about learning how to build abstraction, understanding data-structures, managing complexity, etc. It's not about the details of how you write your for loop. I gave C as an example by assuming he wants to do Unix programming, but any (reasonably readable) language can do. –  rahmu Jun 22 '12 at 5:47
    
And mentioning the Stevens book is not a bad idea either. In all fairness notice I did suggest he learns C (with a link to the K&R) first. There's a tendency to treat beginners as idiots who cannot grasp anything slightly complicated, or lazy people who won't bother thinking for themselves. This is wrong. It is my experience that beginners respond far better to challenging problems. I wouldn't call Unix programming in C particularly difficult; it can be tedious, but it's not that big a feat. Isn't time we stopped demonizing C? –  rahmu Jun 22 '12 at 5:53
    
Thanks for clarifying your points, very helpful. And you are right, you did recommend Stevens after learning C first, my mistake. Also, just to be clear, I am not trying to demonize C, I used it professionally for a number of years some time ago, it has its place. I just don't think it makes a good "first language" for the reasons I stated in my answer/comments. It's not a matter of how short the code is (ie LOCs), but rather how straight forward/simple the syntax is and the lack of need to understand (initially) unnecessary extraneous things for beginners trying to grasp basic concepts. –  Levon Jun 22 '12 at 11:27
add comment

First you have to grab the concept of structured programming. I started programming in BASIC with a very good book that started with explaining structured programming, the concept of loops, decisions, and so on before going to the first "hello world".

After that is was easy to switch over to Assembler, Pascal, Oberon, C, perl and bash (all the procedural ones).

If you plan to become a SysAdmin (aka system programmer) - python, perl, bash are ok. A little understanding of C will not harm, too.

share|improve this answer
add comment

If you are interested in Python, you can download a PDF book called "Invent Your Own Computer Games with Python" by Al Sweigart that starts very at a basic level. It's aimed at teaching kids programming techniques in addition to the Python language, but given your limited experience in programming it might be helpful. Each chapter teaches you a new concept and then shows you how to program with what you have just learned.

Best of all the book is free as a PDF with the option to donate to the author.

share|improve this answer
add comment

I'd suggest JavaScript. It is the language of the Web, so it is useful and runs everywhere. You can also get some satisfying results quickly. Try codecademy.

share|improve this answer
add comment
  • To learn object oriented programming, you should choose the original: Smalltalk.
  • To learn functional programming, Haskell might be one of the purest such.
  • Logicial programming can be learned with Prolog.

This will teach you very different concepts of programming.

If you look for something which you can use to make improvements, to participate in Linux development and applications, your options are

  • C for the Linux kernel.
  • Python for many Gnome apps
  • C and C++ for the many native Linux apps, with the two mainly used frameworks, gtk and Qt.
  • To handle small issues on the shell, bash is most widely used but other shells are fine.

If you want to develop big things on the server or small apps for the android plattform, Java is the the way to go. But since Java is not only a language, but a plattform too, where many bindings exist, you could use JRuby, JPython, Scala, Clojure and other languages too, which means, that nearly everything might be suitable.

So it is more easy to discourage from some languages, than to encourage. I would discourage from some, because they are made from Microsoft where Linux versions might exist, but is a second class citizen, like

  • C#
  • F#
  • VBA

Some languages work, and you get your job done, but they aren't elegant, like

  • PHP
  • Perl
  • Basic
  • Javascript

Many are of a very specialized scope, so that they aren't too useful for a beginner without that specialized problem, like

  • sed (a stream editor language, very useful for text manipulation with regular expressions)
  • awk (similar scope like sed )
  • R language for math, especially statistics/matrix operations
  • Javascript (not that useful outside a browser, while not impossible to use - see rhino)

The lists aren't meant to be complete.

Whichever language you learn: Read The art of Unix programming from Eric S. Rayomond too.

share|improve this answer
add comment

Considering you are in Linux I would go with C because it is its' native language. C++ to me does not count as I do not agree with it being merged into the kernel. There is a vast amount of free resources to go with it.

check out http://freeprogrammingresources.com/

This is where I started to look for a language to learn.

share|improve this answer
2  
C++ hasn't been merged into the kernel ( whatever that's supposed to mean ). The kernel is written in C. –  psusi Jun 22 '12 at 0:49
    
I remember seeing c++ code being compiled on my last kernel upgrade but I would have to look into the source to be sure i guess as the screen fly like an SR-71 Blackbird. –  Joe Jun 22 '12 at 20:07
add comment

Python. We teach it as a first language at The North Carolina School of Science and Mathematics. We have been doing this since 2004. It's a great language for beginners.

share|improve this answer
add comment

The only real answer here is it depends. Turing-completeness guarntees that all your major contenders are pretty much the same.

So you should actually consider the bells and whistles. Which language offers the most of what you consider fun? Fun keeps you interested.

share|improve this answer
add comment

Python & Perl is the best one to start with. You can also go for VB/Java script

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.