Came here to recommend Python and Project Euler. Looked at the comments and saw that it seems to be the emerging consensus anyway.
Another nice road to programming is via Javascript. This way you don’t have to install anything, just make an html file in your favorite editor, write some lines of script there, and view it with your favorite browser. You can try doing Project Euler exercises there, or you can get immediate gratification by coding up some graphical interactive stuff. It’s really easy and fun. This also happens to be the way I originally learned programming (using qbasic instead of js because the web wasn’t around yet). Can’t imagine the other commenters learned programming by jumping into Scheme or Haskell, or reading SICP, or whatever it is they’re recommending :-)
And one last piece of advice: don’t get bogged reading stuff until you come across a specific problem that looks like it should be solved by reading. Most people read too much and do too little, and this skews their perception of what’s good for you. For me, programming is much more similar to building model airplanes than it is to math.
Can’t imagine the other commenters learned programming by jumping into Scheme or Haskell, or reading SICP, or whatever it is they’re recommending :-)
Agreeing with this. I love CS theory, and I love SICP, but I learned to program by basically ignoring all that and hacking together stuff that I wanted to make. If you want to learn to program, you should probably make things first.
Can’t imagine the other commenters learned programming by jumping into Scheme or Haskell, or reading SICP, or whatever it is they’re recommending :-)
I also learned programming by futzing around in QBasic rather than by reading SICP. But is it really safe to conclude that that’s therefore the best way to learn programming? lukeprog writes:
I’ve since discovered that textbooks are usually the quickest and best way to learn new material. That’s what they are designed to be, after all.
Should we really assume that the people writing textbooks are missing the mark so widely that you are better off not even reading the book at all?
In the same spirit, here is another suggestion on how to learn something: take a university course in the subject! That’s what they are designed for, after all. And if benelliot is currently studying math and physics, he probably has access to one.
Quite seriously, I am working as a TA for an intro-level programming course right now, and the students there progress much faster than I did when I first picked up programming through self-study and playing around with little QBasic snippets. Their abilities after two semester-long courses are already at a level I reached only after several years of self-study.
I really did learn programming via SICP-style scheme, culminating in writing an interpreter (but not actually using SICP—I think it was the Schemer’s Guide). I did it in a class, which may make it very different. I (and my teachers) think an important goal in learning to program, a hurdle that most professionals fail to clear, is to believe in the program as a lawful calculation, rather than a willful spirit. Syntax exaggerates this problem. Purely functional languages help by making it easier to simulate the code. Things like Project Euler may play a similar role. Actually, before scheme, I wrote a few simple programs in basic. But they were only primitive recursive and while I could understand more complicated basic programs, I couldn’t imagine writing them.
I would recommend a class based on SICP. Without the discipline of a class, it’s probably not the place to start. Yes, the key is not reading the book, but doing the exercises.
I’m looking to learn more after my intro Java class in college about 6 years ago. Python is widely recommended as a first language, though opinions do vary. I guess I’d plug Dive into Python. Even if you’re not experienced (and I don’t consider myself as experienced after one semester), I’ve found it quite kind and think the rest will scale well.
One other recommendation… just try to do things. Think of something very simple you could use programming to automate and then learn how to do it in the language you chose to focus on. This helps immensely more than simply trying to chug through syntax and theory.
By far my biggest self-edifying programming successes have been when I created something useful to translate something from csv to something else or go through a data set and extract something useful. I think accomplishing real life tasks with programming will help. Also, if you can pick small-ish tasks, the googling around to learn how to do it will be kept to a bit sized piece.
Edit: I put this under a reply to cousinIt, but it’s m ore of a “seconded” nature post and then an expression of why—it’s a reply to the original poster but since cousinIt already mentioned Python, I figured I’d file it under his post as mien is not an original thought.
In addition to Project Euler, I should point out the USACO training pages—that’s where I learned a lot of basic algorithms, data structures, techniques, though I never did make it past chapter 3, IIRC. (The whole thing has been overhauled in the intervening years and I now can only access the very beginning—apparently it now requires solving each problem in a section to move on rather than just most of them...) Project Euler looks to be more basic? Also note that USACO training pages require using one of C, C++, Java, or Pascal, not any of the languages people are recommending. So in conclusion this may be more useful later rather than now...
Actual past mainstream competitions in the training mode is a good fit for what I meant to reference, assuming there is enough of both simple and hard problems in there.
Project Euler looks to be more basic?
From skimming the problems, I got the impression that there are more tricky-math problems than classical algorithmic problems with graphs, strings, languages, geometry, dynamic programming, rote technical skill, etc. There are many sites that are more traditional in this sense, and hence are better suited as companion material for studying the classical algorithms, I’m just not familiar enough with the present resources to name one from the top of my head.
Also note that USACO training pages require using one of C, C++, Java, or Pascal, not any of the languages people are recommending.
For the purposes of these algorithmic problems, a bare minimum of C is sufficient, and you’re going to learn it anyway, so could as well do that from the start. Programming language choice is more of less irrelevant for studying algorithms, and a more powerful language could even be a handicap (you shouldn’t use the conveniently in-built algorithms if you want to understand how they work and how to develop analogous things on your own). So something simple like a basic subset of C or Java-without-libraries might be better.
A more powerful/convenient language is more important on the stage where you learn to implement complicated ideas (which corresponds to the next phase involving studying SICP, on my list).
Oops, deleted my comment. Reposting it for context:
In addition to Project Euler, I should point out the USACO training pages—that’s where I learned a lot of basic algorithms, data structures, techniques, though I never did make it past chapter 3, IIRC. (The whole thing has been overhauled in the intervening years and I now can only access the very beginning—apparently it now requires solving each problem in a section to move on rather than just most of them...) Project Euler looks to be more basic? Also note that USACO training pages require using one of C, C++, Java, or Pascal, not any of the languages people are recommending. So in conclusion this may be more useful later rather than now...
Agreed with all this. Formally interesting programming languages tend to have a fairly steep learning curve, and also tend not to be widely used. If you learn Python or JavaScript you can, if you wish, get a job as a Python coder or web designer relatively easily—I don’t think I’ve ever seen a job for a Haskell coder advertised (though of course if one is advertised then the number of applicants will be much lower).
Came here to recommend Python and Project Euler. Looked at the comments and saw that it seems to be the emerging consensus anyway.
Another nice road to programming is via Javascript. This way you don’t have to install anything, just make an html file in your favorite editor, write some lines of script there, and view it with your favorite browser. You can try doing Project Euler exercises there, or you can get immediate gratification by coding up some graphical interactive stuff. It’s really easy and fun. This also happens to be the way I originally learned programming (using qbasic instead of js because the web wasn’t around yet). Can’t imagine the other commenters learned programming by jumping into Scheme or Haskell, or reading SICP, or whatever it is they’re recommending :-)
And one last piece of advice: don’t get bogged reading stuff until you come across a specific problem that looks like it should be solved by reading. Most people read too much and do too little, and this skews their perception of what’s good for you. For me, programming is much more similar to building model airplanes than it is to math.
Agreeing with this. I love CS theory, and I love SICP, but I learned to program by basically ignoring all that and hacking together stuff that I wanted to make. If you want to learn to program, you should probably make things first.
Thanks for this, very helpful.
I also learned programming by futzing around in QBasic rather than by reading SICP. But is it really safe to conclude that that’s therefore the best way to learn programming? lukeprog writes:
Should we really assume that the people writing textbooks are missing the mark so widely that you are better off not even reading the book at all?
In the same spirit, here is another suggestion on how to learn something: take a university course in the subject! That’s what they are designed for, after all. And if benelliot is currently studying math and physics, he probably has access to one.
Quite seriously, I am working as a TA for an intro-level programming course right now, and the students there progress much faster than I did when I first picked up programming through self-study and playing around with little QBasic snippets. Their abilities after two semester-long courses are already at a level I reached only after several years of self-study.
I really did learn programming via SICP-style scheme, culminating in writing an interpreter (but not actually using SICP—I think it was the Schemer’s Guide). I did it in a class, which may make it very different. I (and my teachers) think an important goal in learning to program, a hurdle that most professionals fail to clear, is to believe in the program as a lawful calculation, rather than a willful spirit. Syntax exaggerates this problem. Purely functional languages help by making it easier to simulate the code. Things like Project Euler may play a similar role.
Actually, before scheme, I wrote a few simple programs in basic. But they were only primitive recursive and while I could understand more complicated basic programs, I couldn’t imagine writing them.
I would recommend a class based on SICP. Without the discipline of a class, it’s probably not the place to start. Yes, the key is not reading the book, but doing the exercises.
I’m looking to learn more after my intro Java class in college about 6 years ago. Python is widely recommended as a first language, though opinions do vary. I guess I’d plug Dive into Python. Even if you’re not experienced (and I don’t consider myself as experienced after one semester), I’ve found it quite kind and think the rest will scale well.
One other recommendation… just try to do things. Think of something very simple you could use programming to automate and then learn how to do it in the language you chose to focus on. This helps immensely more than simply trying to chug through syntax and theory.
By far my biggest self-edifying programming successes have been when I created something useful to translate something from csv to something else or go through a data set and extract something useful. I think accomplishing real life tasks with programming will help. Also, if you can pick small-ish tasks, the googling around to learn how to do it will be kept to a bit sized piece.
Edit: I put this under a reply to cousinIt, but it’s m ore of a “seconded” nature post and then an expression of why—it’s a reply to the original poster but since cousinIt already mentioned Python, I figured I’d file it under his post as mien is not an original thought.
I did put “practice contest programming”, of which Project Euler is one implementation, before SICP (but clarified now).
In addition to Project Euler, I should point out the USACO training pages—that’s where I learned a lot of basic algorithms, data structures, techniques, though I never did make it past chapter 3, IIRC. (The whole thing has been overhauled in the intervening years and I now can only access the very beginning—apparently it now requires solving each problem in a section to move on rather than just most of them...) Project Euler looks to be more basic? Also note that USACO training pages require using one of C, C++, Java, or Pascal, not any of the languages people are recommending. So in conclusion this may be more useful later rather than now...
Actual past mainstream competitions in the training mode is a good fit for what I meant to reference, assuming there is enough of both simple and hard problems in there.
From skimming the problems, I got the impression that there are more tricky-math problems than classical algorithmic problems with graphs, strings, languages, geometry, dynamic programming, rote technical skill, etc. There are many sites that are more traditional in this sense, and hence are better suited as companion material for studying the classical algorithms, I’m just not familiar enough with the present resources to name one from the top of my head.
For the purposes of these algorithmic problems, a bare minimum of C is sufficient, and you’re going to learn it anyway, so could as well do that from the start. Programming language choice is more of less irrelevant for studying algorithms, and a more powerful language could even be a handicap (you shouldn’t use the conveniently in-built algorithms if you want to understand how they work and how to develop analogous things on your own). So something simple like a basic subset of C or Java-without-libraries might be better.
A more powerful/convenient language is more important on the stage where you learn to implement complicated ideas (which corresponds to the next phase involving studying SICP, on my list).
Oops, deleted my comment. Reposting it for context:
In addition to Project Euler, I should point out the USACO training pages—that’s where I learned a lot of basic algorithms, data structures, techniques, though I never did make it past chapter 3, IIRC. (The whole thing has been overhauled in the intervening years and I now can only access the very beginning—apparently it now requires solving each problem in a section to move on rather than just most of them...) Project Euler looks to be more basic? Also note that USACO training pages require using one of C, C++, Java, or Pascal, not any of the languages people are recommending. So in conclusion this may be more useful later rather than now...
(Also edited in a reply to your point about programming languages now.)
Agreed with all this. Formally interesting programming languages tend to have a fairly steep learning curve, and also tend not to be widely used. If you learn Python or JavaScript you can, if you wish, get a job as a Python coder or web designer relatively easily—I don’t think I’ve ever seen a job for a Haskell coder advertised (though of course if one is advertised then the number of applicants will be much lower).