I want to learn programming

post by benelliott · 2011-03-26T10:40:13.369Z · score: 7 (10 votes) · LW · GW · Legacy · 56 comments

I would like to learn programming but haven't been able to get started. Advice appreciated, both high-level (you should try learing language X) and low level (you can find a program that will run language X here), the latter has been a particular problem for me, I don't really know how this sort of thing works.

I am currently studying maths and physics, and I have a particular talent for the former, so I would probably do well with a language that plays to that strength. My only actual experience with programming was when my father let me play around with Jython a bit when I was about 13, I had some fun calculating prime numbers and approximating pi but never got any farther.

Thanks in advance for all suggestions.

56 comments

Comments sorted by top scores.

comment by cousin_it · 2011-03-26T15:14:20.859Z · score: 17 (17 votes) · LW(p) · GW(p)

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.

comment by nhamann · 2011-03-26T16:16:27.794Z · score: 4 (4 votes) · LW(p) · GW(p)

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.

comment by Pfft · 2011-03-26T23:58:20.992Z · score: 2 (2 votes) · LW(p) · GW(p)

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.

comment by Douglas_Knight · 2011-03-26T20:38:03.056Z · score: 2 (2 votes) · LW(p) · GW(p)

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.

comment by benelliott · 2011-03-26T16:03:11.648Z · score: 2 (2 votes) · LW(p) · GW(p)

don't get bogged reading stuff until you come across a specific problem that looks like it should be solved by reading.

Thanks for this, very helpful.

comment by jwhendy · 2011-03-28T21:24:31.267Z · score: 0 (0 votes) · LW(p) · GW(p)

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.

comment by Vladimir_Nesov · 2011-03-26T17:34:37.293Z · score: 0 (0 votes) · LW(p) · GW(p)

I did put "practice contest programming", of which Project Euler is one implementation, before SICP (but clarified now).

comment by Sniffnoy · 2011-03-26T20:52:39.802Z · score: 0 (0 votes) · LW(p) · GW(p)

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

comment by Vladimir_Nesov · 2011-03-26T21:03:00.190Z · score: 0 (0 votes) · LW(p) · GW(p)

I should point out the USACO training pages

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).

comment by Sniffnoy · 2011-03-26T21:04:37.607Z · score: 1 (1 votes) · LW(p) · GW(p)

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

comment by Vladimir_Nesov · 2011-03-26T21:16:11.124Z · score: 0 (0 votes) · LW(p) · GW(p)

(Also edited in a reply to your point about programming languages now.)

comment by [deleted] · 2011-03-26T16:52:32.811Z · score: 0 (0 votes) · LW(p) · GW(p)

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).

comment by wmorgan · 2011-03-26T19:52:06.608Z · score: 10 (10 votes) · LW(p) · GW(p)

Professional programmer here.

Learn Python The Hard Way is a guide to programming that starts from the very basics. It's one of the very few guides that I've seen that appreciates the hardness of the subject. I would recommend it for anyone with minimal programming experience, because it will build rock-solid fundamentals.

comment by sketerpot · 2011-03-27T02:45:27.774Z · score: 3 (3 votes) · LW(p) · GW(p)

Yes. Hell yes. If someone is starting programming, then Learn Python the Hard Way is the best book I know of. It doesn't swamp you with words, nor with code; it gives you some stuff to type in at the Python prompt, and figure out as you go. It's like a series of puzzles that are each really easy to solve, and once you get through them, you'll be thinking like a programmer.

I've taught an intro to programming class, and seen where the problems are, and beheld the glaring deficiencies in most textbooks. LPtHW is a Right Thing. It boils with rightness.

You can buy a hard copy, or read it online (PDF).

comment by beriukay · 2011-03-27T09:40:04.174Z · score: 0 (0 votes) · LW(p) · GW(p)

I'm a novice at programming, and I agree with wmorgan and sketerpot.

I'm halfway through LPTHW, working on the project of making a text-based adventure game, and find it rather fun. Concurrently, I have been taking an introductory class on Java programming, and 9 weeks in, the class is still trying to catch up to the book.

comment by vii · 2011-04-01T07:25:19.836Z · score: 8 (8 votes) · LW(p) · GW(p)

I'm a student of computer science and a professional programmer, and I've learned from reading SICP among many other sources, but I don't recommend that route for a novice that does not actively seek out and enjoy reading mathy textbooks. I know that I prefer fun, interactive, and game-like learning, and you probably do to.

You: I want to learn to program...but I'm too lazy/shy to download anything, or even look at a book - even if its online. But I guess if the computer basically talks to me and walks me through things (interactively in the browser!)...then I might spare 20+ minutes.
Me: Great! You have 20 minutes? Stop reading this and tryruby.org.
You: Uh, first I want to see what else you have to say...and look at some other comments, and do my job or something.
Me: Nope. Stop what you are doing right now and click the link. Life can wait.

You: Wow. That wasn't that hard. I can actually code now! But I want more...fine, I'll look at a book...as long as it's online, and free, and it lets me test and experiment with what it's teaching me without leaving the page.
Me: eloquentjavascript.net

You: Ok, that's pretty amazing. I never knew it would by that easy to dive into this stuff - with just this knowledge I can already write a complete interactive website - I mean, ruby and javascript are all twitter had to work with and look at them now! But I feel like I'm still mostly just learning to program and I yearn for more. I want to grok the deep structure of procedures and computation. What should I do?
Me: SICP Tutor Now that you've gotten over your activation energy hurdle, it is time to unlock the sacred power of SICP - except with this site (made for the author's class) the slides talk to you and the problems check themselves. I also do highly recommend the actual book and lectures (available online for free). And for maximal learning you should download and play with a scheme interpreter outside of the site, even though you don't need to.

You: Ok, you win. I'm now well on the path to being the next Jeff Dean. Anything else I should know about?
Me: Since you asked so nicely...if you like zombies, railsforzombies.org is a decent video introduction to a web framework with videos and checked problems.
Scratch is a great way to play around with basic programming and make 'art', and if you give it to a kid they might figure it out before you do.
If you want to experiment in the browser with making very pretty moving things, check out sketchpad.cc. Anyway...I have to go program my computer to do my dishes for me. But let me know if you find anything else in this vein, and pass it along.

You: Thanks, will do! exit(0);

comment by Vladimir_Nesov · 2011-03-26T14:41:31.470Z · score: 8 (8 votes) · LW(p) · GW(p)

A sensible piece of general advice: How to be a Programmer by Robert L. Read.

Practice contest programming (e.g. Project Euler to start, but look for other options) while/after studying Introduction to algorithms (CLRS). This will teach you basic "just do it" skills and give ability to solve deep algorithmic problems and feel the outline of computational complexity of any given solution.

After you get a bit of experience with getting things done, read Structure and Interpretation of Computer Programs (SICP). It will teach you to represent complicated ideas in code and not get lost (which includes skills that subsume a lot of what's referred to by OOP, design patterns, etc., although it's useful to know that language as well). Together with CLRS it'll form the basis of theoretical side of your technical competence.

In the beginning, don't worry about programming languages or APIs. Don't waste time learning all the tiny details or system-specific coding advice, there is too much of low-hanging fruit in general flexible skills that would apply to any language or system. Just know enough to express whatever you want to express (but do look for standard ways of doing things before reinventing specific wheels), and get a lot of practice.

Work on a big project you didn't write, using APIs you didn't know. It'll teach you to figure out your way around originally unknown territory, and to modify the code in the way that doesn't disrupt its (always less than optimal) structure and conventions.

In time (but don't rush it), pick up more things from, for example, books on this list. Getting to that too early is a bit dangerous, since you won't be able to tell good advice from bad, will waste time and attention developing worthless skills, and the good advice can be over your head, impossible to correctly interpret and benefit from the way you'd be able to after having enough experience.

comment by Furcas · 2011-03-27T21:29:21.400Z · score: 5 (5 votes) · LW(p) · GW(p)

The video lectures for both of the books recommended by Vladimir are available on MIT's OpenCourseWare:

Introduction to Algorithms

Structure and Interpretation of Computer Programs

comment by JenniferRM · 2011-03-30T00:47:09.523Z · score: -1 (1 votes) · LW(p) · GW(p)

Neat online classes! I didn't know about those.

Also, there is a free online version of the wizard book (which is the nickname for the Structure and Interpretation of Computer Programs based on the cover with the guy in a crazy turban with the lambda symbol in the flash of light next to him).

If you want to jump in directly, my recommendation would be to download a Lisp or Scheme interpreter (like Gauche, for example), fire it up, and then read through the wizard book, typing in all the example code by hand. In my experience, practicing the manual production of code is critical to developing fluency.

Finally, I kind of feel bad about recommending this without a half-warning... Functional programming is beautiful, but depending on where you live and the rest of your educational background, it may be relatively hard to use it to pay the bills and you might be setting yourself up to always be dissatisfied with the tools you actually use day to day. Lisp has a minor reputation for appealing to a certain kind of person who is really smart and technically proficient, but not necessarily the best team player. I'm not sure, but I suspect the rarity of Lisp jobs is related to this.

If you want to earn money from coding, it may be better for you to learn a general programming language like C++, Java, Python, C#, Ruby, or maybe Erlang (which is rare, but has relatively high paying jobs because the coding for it is frequently associated with critical and expensive machinery like telephone networks). SQL is another kind of "code" that isn't really a full blown programming language, but that can be useful for set processing using a language inspired by predicate logic.

comment by fubarobfusco · 2011-03-26T18:19:21.167Z · score: 6 (8 votes) · LW(p) · GW(p)

As far as I can tell, the key to becoming good at programming — or one key, anyway — is to learn several different languages. Programmers who learn only Python or only Java or only C tend to see the whole computing world through the lens of their specific language. Since every language makes some tasks or ideas easy or obvious, and others hard or impractical, having a well-rounded view requires familiarity with several different languages. Which language to start with seems pretty much irrelevant, so long as you don't stop with just one language.

comment by Vladimir_Nesov · 2011-03-27T19:09:37.059Z · score: 0 (0 votes) · LW(p) · GW(p)

SICP helps with this problem in a language-independent setting.

comment by Morendil · 2011-03-26T11:08:38.906Z · score: 6 (6 votes) · LW(p) · GW(p)

I recommend ProjectEuler, as it will complement your strengths.

It is a set of graded math/programming problems, each of which has a single unambiguous correct answer, and you can compare your solution to other people's once you have found the answer. I recommend doing the problems in order.

What operating system is installed on your computer?

comment by benelliott · 2011-03-26T11:11:50.039Z · score: 0 (0 votes) · LW(p) · GW(p)

Windows 7

comment by Morendil · 2011-03-26T13:57:50.517Z · score: 6 (6 votes) · LW(p) · GW(p)

In that case I'd second the Python recommendation, and add Ruby, as mainstream choices; for a somewhat more exotic choice see Haskell which I've found excellent for Project Euler type problems.

Both Python and Ruby are interpreted ("scripting") languages, which allows you to focus on the programming and not worry overmuch about ancillary matters such as compiling and linking.

Haskell is compiled but also has an interpreter; it's a functional language, a programming paradigm which is perhaps closer to the mathematician's way of looking at things. When I was playing with Project Euler it was as an exercise to learn Haskell, and I really liked how the language and the problems meshed together.

For instance you'd start on the first problem by defining a predicate, a boolean-valued function, determining divisibility. (You can type almost everything in what follows into the Haskell interpreter if you want to follow along.)

In the Haskell interpreter ghci this is done by using the keyword let, followed by the function name, followed by formal parameters, followed by "=", followed by the function definition:

let divides d n = mod n d == 0

If you've done prime numbers already this should be somewhat familiar: "mod" is the modulo operator. (There is also a Haskell notation to express this in the more familiar infix form; you can look that up later.)

In Haskell as in math you can leverage your definitions in further definitions, so we can say, naming our predicate "divisible by 3 or 5" fizbuz in honor of a common programmer's meme:

let fizbuz n = (divides 3 n) || (divides 5 n)

Where Haskell and other functional languages shine is that functions can be used as parameters to other functions. For instance, you can pass a predicate as a parameter to a primitive function named "filter", which takes a predicate and a list, and returns only items in the list matching the predicate:

filter fizbuz [1,3,5,7]

should return [3,5]. Haskell has plenty of primitive functions which operates on lists - you can build lists, filter lists, but also for instance sum over lists:

sum [1,3,5,7]

will return 16. We can also use this syntax to define lists from more compact ranges: [1..10] means the integers between 1 and 10.

Another area where Haskell feels like home to a mathematician is that you can compose functions, and reason formally on the types of functions and their arguments. For instance the type of our function "filter" is this:

(Integer -> Bool) -> [Integer] -> [Integer]

(Don't type this in at the ghci prompt. You rarely need to enter these types by hand, because Haskell figures them out for you. But you sometimes will have to, in order to lift some ambiguity for instance.)

We parse this as "a filter is a function which takes as arguments a function mapping integers to booleans, and a list of integers, and returns a list of integers". The type of this function:

let filterBy3or5 = (filter fizbuz)

is therefore [Integer] -> [Integer], that its, it takes a list and returns a list. Since the "sum" function takes a list and returns an integer, we can compose sum and this function (but, note well, not the other way around)

let sumFilteredList = sum . filterBy3or5

or equivalently

let sumFilteredList = (sum . (filter fizbuz))

The latter being "more expressive" and therefore preferable because it shows more clearly how our computation is arranged: we sum over a list filtered by a particular predicate.

Now finding the solution to problem 1 is as simple as entering:

sumFilteredList [1..10]

for the test case, and solving the real problem is left as an exercise for the reader.

What's nice about this is that several early problems also take the form of "sum over a filtered list of integers in a certain range". All you have to do to make these problems dead easy to solve is turn the predicate by which the range is filtered into a parameter to sumFilteredList. Then each such problem reduces to a particular case of the general procedure of filtered summing which you have already solved.

comment by IlyaShpitser · 2012-12-08T23:08:19.968Z · score: 1 (1 votes) · LW(p) · GW(p)

sum [ i | i <- [1..999], mod i 3 == 0 || mod i 5 == 0 ]

:)

Haskell is amazing for Project Euler. Lots of these problems are one liners in Haskell. Actually I think Project Euler is excellent for learning Haskell tricks specifically, even if you know how to program already. For certain types of tasks, Haskell is an immense force multiplier.


Of course the difficulty with Haskell is that it is both functional and lazy, which means it explicitly hides the causal order of operations from you for other gains (expressiveness, parallelism, etc.) The problem with this is that in order to debug a Haskell program (or any computer program), a human brain needs to construct an accurate causal model of what's going on.

Debugging software is generally the act of repeated interventions into a malfunctioning system to figure out where the malfunction is. Languages like Haskell go against this grain by making it difficult to figure out what your intervention is doing due to the hidden causal order (try inserting a print statement into a Haskell program sometime). This is why, I believe, functional programming never caught on -- functional programs are very convenient for compiler programs to reason about, but very inconvenient for people.

comment by jsalvatier · 2011-03-27T03:19:42.737Z · score: 2 (2 votes) · LW(p) · GW(p)

This lets you try 10ish different languages in your browser: http://codepad.org/

comment by taryneast · 2011-03-26T18:01:42.135Z · score: 1 (1 votes) · LW(p) · GW(p)

I second the Ruby nomination :) And to get started quickly (without any installation) I'd recommend:

Try Ruby

comment by Perplexed · 2011-03-26T20:00:56.677Z · score: 5 (5 votes) · LW(p) · GW(p)

I'm retired now, but I programmed professionally in a half-dozen languages, played around with a dozen more, and briefly taught in four of them at the college level. My suggestion would be to start with something fun and easy to get started in. I enjoyed my recent first experience with NetLogo creating simple graphical simulations of ecological or astrophysical systems. I don't think I have ever seen a programming system in which learning how to construct a GUI for a program was so easy. And the language is rich enough so that you can also learn a bit about thinking like a programmer - "What algorithm generates the result I want?"

But NetLogo is just a toy language and it will satisfy you for only a month or two. Next, I would suggest moving on to an interpreted functional language - either Haskell or some variant of Scheme - for a few months of more serious play.

Only then would I move on to a more serious compiled object-oriented procedural language using an industrial-strength IDE. I would suggest picking two languages to learn well - one from column A (Java, C++, Python, Smalltalk, or Scala) and one from column B (Haskell, Scheme, 'R', Ruby, APL, Forth, or something totally exotic like a language associated with a proof assistant).

If you are not currently a Unix user, your biggest decision may be whether you want to become a Unix user. Because most of the programming language stuff (that you don't have to pay big bucks for) assumes that you work in a Unix-like environment. If saving money is important to you, and you don't currently know much Unix-speak, then you will find that learning Unix will be just as difficult and time consuming as learning a programming language. But also just as useful - maybe more so.

comment by zyxie · 2011-03-26T18:58:39.827Z · score: 3 (3 votes) · LW(p) · GW(p)

For context, I've been teaching myself programming for about 10 years, and I'm currently a professional programmer.

The most important thing in programming is that you find something that you enjoy. There's enough variety in terms of languages and problems out there that you're bound to find something that works for you. Once you find something that's fun (and therefore easier) for you, it won't be too hard to bootstrap into more complicated languages and problems.

As far as problems go, start with something simple, and work your way up. An excellent way to do this is Project Euler, which many people here have recommended as well. I think it would fit particularly well in your case, since many of the problems on that site are mathematical. Another great thing about Euler is that it is language-independent. Make sure that after you solve a problem, you read the solutions other people have posted. You can find examples of a lot of different languages and styles.

As to language choice, I'd go through some tutorials online, and see what makes sense to you. One you might try is Why's Poignant Guide to Ruby. Maybe some other people have other good recommendations for other languages. Try the first few problems in several languages, and see what makes the most sense to you. I like Java and Python. Personally, I'd avoid LISP, Scheme, Haskell, and other more academic languages unless you're particularly ambitious, and/or you know people who use them.

An important skill in programming I think most people forget is this: Research skills. I've got a lot of experience programming, but I come across an enormous amount of things that I simply don't know how to do. Get used to using google to find answers. It's much faster than asking people or looking it up in a book.

comment by Daniel_Burfoot · 2011-03-26T17:09:12.053Z · score: 3 (3 votes) · LW(p) · GW(p)

Think up a good project to work on. This is going to give you extra motivation, plus create synergy with your other goals. Let the choice of project guide your choice of initial language toolset.

A good intro project should be small, self-contained, and well-defined. For example, if you like boad games, trying writing an implementation of some game to you can play against your friends online.

For extra points, post a note to LW committing to the project, and setting a deadline to complete it.

comment by jsalvatier · 2011-03-27T03:15:13.134Z · score: 0 (0 votes) · LW(p) · GW(p)

Yes. This is good advice even for learning your nth language. For learning Python, I built a very simple package for simulating process engineering unit operations (heat exchangers, reactors, distillation columns etc.) and stringing them together. This worked very well.

comment by XiXiDu · 2011-03-26T11:49:05.850Z · score: 2 (6 votes) · LW(p) · GW(p)

Haskell, because it impinges upon math. And Python because it is popular, open source and closer to what one could call mainstream programming. At least that is what people told me to do when I asked the same question.

Here is all you need to get started. For Haskell just download The Haskell Platform or go to tryhaskell.org, an online, in-browser Haskell interpreter. Then go to Learn Haskell in 10 minutes.

ETA: If you are interested in a free PDF of the book The Haskell Road to Logic, Math and Programming...you know.

comment by Douglas_Knight · 2011-03-26T19:37:24.709Z · score: 1 (1 votes) · LW(p) · GW(p)

Last time this subject came up, you seemed to be embarking on learning programming through Haskell. If that's what you did, could you write about your experiences?

ETA: last time

comment by XiXiDu · 2011-03-26T20:31:05.013Z · score: 3 (3 votes) · LW(p) · GW(p)

Last time this subject came up, you seemed to be embarking on learning programming through Haskell. If that's what you did, could you write about your experiences?

Read up on it, decide that it is worth it, gather tutorials and books and then postpone it because there have been and still are more important and in some cases necessary things to learn. And I didn't really want to learn programming, I still don't. I want to be able to read, understand and appreciate code and algorithms in general. I don't want to become a poet, I want to be able to read and appreciate poetry. My main interest right now is to survey human knowledge and search for unknown unknowns to be able to judge the current state of affairs and put everything into perspective. Being able to read code is like learning a foreign language, it opens up a whole new world of knowledge and installs a new cognitive toolkit. I just don't have the time and resources to concentrate enough on a single area to become proficient enough to make valuable additions to that area. And I don't think it is even necessary to be able to contribute yourself to a field to judge its importance and tell apart what is valuable from what is worthless or just wrong.

I ask myself, what do I want and how do I achieve it? What am I doing and why am I doing it? How do the answers to those questions align? What I am doing is to survey the landscape of human knowledge to establish an informed set of achievable desires. If I don't know what is out there, what is possible, how can I tell that what I want is desirable? I am trying to find out what I ought to want, which set of desires is consistent, achievable and does yield the maximal possible satisfaction given the nature of reality.

I already know the LW answer, figure out friendly AI which is then going to figure out what you want. If I'd fully accept that answer there would be no sense for me to learn to read code at all right now because I don't expect to be able to earn more money that way, money that I could then donate to the SIAI. The only reason to learn to read code that would be left then would be as recreational activity.

comment by Vladimir_M · 2011-03-27T02:52:09.168Z · score: 5 (5 votes) · LW(p) · GW(p)

And I didn't really want to learn programming, I still don't. I want to be able to read, understand and appreciate code and algorithms in general. I don't want to become a poet, I want to be able to read and appreciate poetry.

That's like trying to understand math without ever solving any problems with your own hand. It's not a viable way to understand anything, though I suppose it may be a viable way to fool yourself into thinking that you understand things.

comment by XiXiDu · 2011-03-27T10:17:52.457Z · score: 1 (1 votes) · LW(p) · GW(p)

That is what I am actually doing. That's not what I meant. What I meant is that you don't have to be able to write the sequences from scratch to understand them.

Here's a phenomenon I was surprised to find: you'll go to talks, and hear various words, whose definitions you're not so sure about. At some point you'll be able to make a sentence using those words; you won't know what the words mean, but you'll know the sentence is correct. You'll also be able to ask a question using those words. You still won't know what the words mean, but you'll know the question is interesting, and you'll want to know the answer. Then later on, you'll learn what the words mean more precisely, and your sense of how they fit together will make that learning much easier. The reason for this phenomenon is that mathematics is so rich and infinite that it is impossible to learn it systematically, and if you wait to master one topic before moving on to the next, you'll never get anywhere. Instead, you'll have tendrils of knowledge extending far from your comfort zone. Then you can later backfill from these tendrils, and extend your comfort zone; this is much easier to do than learning "forwards". (Caution: this backfilling is necessary. There can be a temptation to learn lots of fancy words and to use them in fancy sentences without being able to say precisely what you mean. You should feel free to do that, but you should always feel a pang of guilt when you do.) — Ravi Vakil

comment by jsalvatier · 2011-03-27T03:21:43.746Z · score: 0 (0 votes) · LW(p) · GW(p)

I hope you did some programming as learning how to understand code would be difficult without actually making some.

comment by sketerpot · 2011-03-27T02:28:54.255Z · score: 0 (0 votes) · LW(p) · GW(p)

And I didn't really want to learn programming, I still don't. I want to be able to read, understand and appreciate code and algorithms in general.

Lots of people learn programming because it's a useful tool for whatever else they're doing. Quite a few biologists, for example, learn Perl because it's the traditional bioinformatics glue language.

I would recommend that if someone can learn programming, then they should do it, preferably in a mainstream language like Python. It gives you all sorts of cool data-mangling powers. Actually becoming good at programming is less important, though still very useful.

comment by Will_Newsome · 2011-03-26T14:55:16.843Z · score: 0 (2 votes) · LW(p) · GW(p)

Channeling Steve Rayhawk, I gotta second the Haskell recommendation since some of the cool super-theoretical category theory delimited continuation abstract machine nonsense blends into other stuff that may end up being useful for FAI stuff, and it's probably pretty fun besides that.

comment by sketerpot · 2011-03-27T02:35:03.706Z · score: 1 (1 votes) · LW(p) · GW(p)

Damn, I don't know what a "category theory delimited continuation abstract machine" is yet. Looks like I still need to learn more Haskell.

(I hereby dub this quale "The Haskell sensation".)

comment by Helge · 2011-03-26T11:24:53.519Z · score: 2 (2 votes) · LW(p) · GW(p)

It really depends on what exactly you want to achieve. If you want something theoretically interesting (<= math interest), maybe start out here: http://en.wikipedia.org/wiki/Scheme_(programming_language) or here: http://en.wikipedia.org/wiki/Haskell_(programming_language)

I recommend just doing some tutorial which you will find via these pages or via Google. You will also find free compilers and interpreters.

comment by Emile · 2011-03-26T10:57:20.381Z · score: 2 (2 votes) · LW(p) · GW(p)

This probably isn't the best place to ask that.

But you could just follow a Python totorial, Python is easy to download and play around with.

comment by [deleted] · 2011-03-26T14:32:26.989Z · score: 1 (1 votes) · LW(p) · GW(p)

Also, MIT OCW has some problems and solutions for learning Python.

comment by jsalvatier · 2011-03-27T02:00:42.478Z · score: 1 (1 votes) · LW(p) · GW(p)

Let us know how this is progressing in next months What Are You Working On? thread.

comment by Vladimir_M · 2011-03-26T21:01:07.686Z · score: 1 (3 votes) · LW(p) · GW(p)

One thing I'd emphasize is that absolute beginners are often intimidated by the tools themselves. Faced with the incomprehensibly obscure console commands or IDEs with myriads of mysterious-looking buttons and dialog boxes, it can be hard to figure out how to even start writing simple beginner-level programs, especially if the language itself requires that even the simplest programs must include some obscure-looking code for initialization, declarations, imports, etc. Thankfully, these days you can probably find good tutorials on the web that should make these initial steps less scary.

As for the beginning language, that strongly depends on what your goals are. To become a good generalist, I would recommend learning C and assembly (for whatever architecture; x86 is probably not a good choice for beginners compared to e.g. MIPS), and also studying the inner workings of compilers (i.e. how parsers, optimizers, and code generators work, and also how various high-level language constructs map onto the concrete memory layout and machine code patterns). When faced with a novel language, this should allow you to immediately figure out what's the rationale behind its various features that would otherwise look arbitrary and strange. Also, in my experience, moving from C to almost any imperative language, including object-oriented languages, is a fairly easy transition. (I have very little experience with functional languages, but these also have to run on top of virtual machines written in imperative ones.)

Of course, if you have more specific goals in mind, like focusing on web programming or numerical calculations, a different and less generalist approach is probably advisable.

comment by vii · 2011-04-01T07:08:23.958Z · score: 0 (0 votes) · LW(p) · GW(p)

I'm a student of computer science and a professional programmer who has learned from reading SICP among many other sources, but I don't recommend that route for a novice that does not actively seek and enjoy reading mathy textbooks. I prefer fun, interactive, and game like learning, and you probably do to.

You: I want to learn to program...but I'm too lazy/shy to download anything, or even look at a book - even if its online. But I guess if the computer basically talks to me and walks me through things (interactively in the browser!)...then I might spare 20+ minutes. Me: http://tryruby.org/ Stop reading this and click it. You: Uh, first I want to see what else you have to say...and look at some other comments, and do my job or something. Me: Nope. Stop what you are doing right now and click the link. Life can wait.

You: Wow. That wasn't that bad. Ok, fine, I'll look at a book...as long as it's online, and free, and it lets me test and experiment with what it's teaching me without leaving the page. Me: http://eloquentjavascript.net/

You: Ok, that's pretty amazing. I never knew it would by that easy to dive into this stuff - with just this knowledge I can already write a complete interactive website - I mean, ruby and javascript are all twitter had to work with and look at them now! But I feel like I'm still mostly just learning to program and I yearn for more. I want to grok the deep structure of procedures and computation. What should I do? Me: http://icampus.mit.edu/xtutor/content/?6001publichints Now that you've gotten over your activation energy hurdle, it is time to unlock the sacred power of SICP - except with this site (made for the author's class) the slides talk to you and the problems check themselves. I also do highly recommend the actual book and lectures (available online for free). And for maximal learning you should download and play with a scheme interpreter outside of the site, even though you don't need to.

You: Ok, you win. I'm now well on the path to being the next Jeff Dean (http://www.quora.com/What-are-all-the-Jeff-Dean-facts). Anything else I should know about? Me: Since you asked so nicely...if you like zombies, here's a decent video introduction to a web framework with videos and checked problems http://railsforzombies.org/ And here's a great way to play around with basic programming, and if you give it to a kid they might figure it out before you do: http://scratch.mit.edu/ Let me know if you find anything else in this vein, and pass it along.

You: Thanks, will do! exit(0)

comment by DanielLC · 2011-03-26T21:39:45.675Z · score: 0 (0 votes) · LW(p) · GW(p)

I suggest javascript. All you need to run it is a browser, which you clearly have. Also, if you want to put a program on the internet, if you use javascript people won't have to download it.

comment by [deleted] · 2011-03-26T12:42:53.841Z · score: 0 (6 votes) · LW(p) · GW(p)

http://www.catb.org/~esr/faqs/hacker-howto.html That's by Eric Raymond, who at that time was a respected programmer (he's now a disrespected far-right-wing blogger).

To summarise his advice, first get an open-source UNIX on your computer (e.g. Debian GNU/Linux, which can be downloaded from http://debian.org ). UNIX is a much better programming platform than Windows, and you can install it so your system can switch between it and Windows (though personally I'd just drop Windows altogether).

Then start with Python. http://www.pythonlearn.com/ seems a very good resource (I found that yesterday via ciphergoth's twitter feed).

I second the recommendation of Project Euler. The problems there are simple enough that you can probably solve them very quickly, but still tricky enough to stretch your programming muscles.

Once you've learned Python, you really need to look at at least one of C or C++. These are the standard languages for low-level systems programming, but they're also the basis for a huge number of other languages - if you know even a little bit of C, then Java, C#, Perl and so on will all be trivial to pick up.

If you really don't want to switch operating systems (though I really, really urge you to do so if you ever want to do serious work), I recommend trying to learn one of Microsoft's proprietary languages using Visual Studio Express ( http://www.microsoft.com/express/Windows/ ). Visual Studio lets you knock together quick-and-dirty GUI apps for Windows in a matter of (sometimes literally) seconds. If you're sure you don't want to use another OS, then it's the only way forward, really. I'd recommend starting with Visual C# (which is very similar to Java, so you can switch to that with relative ease) - C++ is a bit hard as a beginner's language, and while I quite liked Visual Basic when I played with it, there's a consensus among programmers that learning Basic rots your brain.

Hope that helps.

comment by jimrandomh · 2011-03-26T13:52:01.034Z · score: 4 (4 votes) · LW(p) · GW(p)

You can get a Unix-like environment on a Windows system by installing Cygwin. This is significantly easier than and less of a commitment than switching operating system.

comment by Vladimir_Nesov · 2011-03-26T16:53:40.701Z · score: 2 (2 votes) · LW(p) · GW(p)

Nowadays you can just work in a virtual machine. Cygwin is a terrible hack in comparison.

comment by jimrandomh · 2011-03-27T01:28:50.208Z · score: 0 (0 votes) · LW(p) · GW(p)

May I ask where your negative impression of Cygwin comes from? I don't agree that virtualization is desirable for one's primary development environment (though it's extremely handy for testing and porting), because I've found it to be a recurring source of trivial inconveniences. But my view of Cygwin is from the perspective of a power user; I've been using it for a long time and have gotten used to/found workarounds for all its issues.

comment by Vladimir_Nesov · 2011-03-27T08:33:13.508Z · score: 0 (0 votes) · LW(p) · GW(p)

You yourself point out that both solutions have their trivial inconveniences. But at least in a virtual machine you can have an off-the-shelf complete linux with no porting issues.

comment by [deleted] · 2011-03-26T16:47:55.029Z · score: 2 (4 votes) · LW(p) · GW(p)

I take your point, but disagree. Cygwin isn't especially user-friendly, and modern GNU/Linux distros are trivially easy to install as dual-boot systems, so there's no real commitment there. And if you're using a real GNU/Linux distro then you'll be able to find help for your exact version of the software much more easily - cygwin has a fairly small install base by contrast.

comment by Nic_Smith · 2011-03-26T17:01:32.061Z · score: 1 (1 votes) · LW(p) · GW(p)

Another possibility is to run some variety of Linux in VirtualBox or the like under Windows. I haven't done this myself, but I know a few people who swear by it.

comment by zyxie · 2011-03-26T19:44:13.377Z · score: 3 (3 votes) · LW(p) · GW(p)

I'd recommend against installing Unix/Linux unless you're already familiar with it. Learning programming and learning Unix are both non-trivial tasks. While I agree that Unix is generally a better environment for programming, I think it's better to focus on one thing at a time. Optimizing your programming environment is secondary to using an environment you're comfortable with.

comment by [deleted] · 2011-03-26T22:30:22.013Z · score: 1 (3 votes) · LW(p) · GW(p)

I disagree - I tend to agree with Perplexed above:

"If you are not currently a Unix user, your biggest decision may be whether you want to become a Unix user. Because most of the programming language stuff (that you don't have to pay big bucks for) assumes that you work in a Unix-like environment. If saving money is important to you, and you don't currently know much Unix-speak, then you will find that learning Unix will be just as difficult and time consuming as learning a programming language. But also just as useful - maybe more so."

I think that learning best practices from the start is much better than getting used to doing things sub-optimally. Yes, one can program on any system, but UNIX and its derivatives are designed for programming in a way that Windows just isn't. You can learn to play music on a guitar with only five strings if that's all you've got - and it's easier to start with, one less string to worry about - but you'll always be at a disadvantage to those who've got an extra string on their guitar.