Hacker News new | past | comments | ask | show | jobs | submit login
What programming language should I start with?
20 points by zenobo on Aug 21, 2007 | hide | past | favorite | 116 comments
Oh no! a non-programmer on the hacker news! But I figure you guys know?

I want to learn programming, maybe not to be a full-fledged hacker, but to be able to understand the concepts and be able to talk about this stuff more with programmers so I can work in tech?

I hear python and ruby are good to learn on, but what would you guys do or are there any good books you'd read?

Python is a great language to start, and even stay with. I've taught a few people to program in python. Very simple syntax, well supported, you'll love it and it will make a lot of sense. Start with python.org to download and learn.

I used to like Python, but now Scala is may favorite:


...and also check out the new documentation for the coming versions of Python 2.6/ Py3k. Soon coming to a screen near you directly from Bavaria - Lederhosen and beer not included ;)


Why would he want to do that as a newbie?

Sorry.. This is probably the wrong question for you to ask :)

The first question to ask is, "What would I enjoy creating? A website? A video game?"

Based on that answer, you then choose the best tool for the job. Depending on the answer, you may only have one choice.

Preferred: Python. clean, elegant, pure, simple, easy.

Just fine: Ruby. good, but less simple and elegant than Python.

Good if you want to deeply understand the principles of being a programmer but don't care about being very practical at the start: Lisp (yes, Lisp can be practical, but it's trouble for a newbie)

Avoid: Perl, PHP, BASIC variants. These cause brain damage.

"Avoid: Perl, PHP, BASIC variants. These cause brain damage."

Many perl mongers, myself among them, would disagree. But maybe the brain damage has set in and I can't judge properly. But, really, you're showing serious ignorance placing Perl in the same sentence as PHP and BASIC. Perl is on the power continuum somewhere just shy of Lisp, and along-side Ruby (possibly even above it; Perl 6 will place it squarely above any other mainstream language on that continuum). Not liking the syntax is no excuse for misleading newbies into thinking Perl is in the same class as PHP.

Anyway, many a developer learned programming with Perl. Some even turned out good.

Agreed - I don't use Perl any more, having grown disillusioned with its messiness a long time ago, but it's certainly much more of a serious language than PHP.

I mean really what made you say such things about PHP? not being a serious language like Perl? This is not an attack mind you, but I'm curious to know what Yahoo, Flickr, Wikipedia, and perhaps to some extent Facebook seemed to have missed when they decided to use PHP for server side stuff. What's with all the PHP hate here in YC anyways?

The reason I can't stand it is because I've had to deal with so much of it that sucks. Also, it just doesn't feel like what I want in a language.

The real double edged sword for PHP is that it made it very easy to do web programming. The good side of that is that it let a lot of people write web stuff who otherwise might not have been able to. The bad side of that is that a lot of those people write really bad code that is no fun to clean up.

How exactly did PHP ever make it "very easy" to do web programming? Was that when register_globals was on? Was it that there was plenty of example code to cut and paste?

I hear this "easy" term applied to PHP by many people, but when I look at the language itself, I don't see it. PHP is easy for me because I did C for 12 years, but I look at the comp.lang.php newsgroup and see newbies tripping over all sorts of things.

There is a well-worn path for beginners in PHP, with baby steps and encouragement all along the way. You can gradually mix PHP into your HTML site, line by line and file by file, and make your site better with each step. (Look, I've got the date in my Web page and it actually updates!)

There's a tradition of building simple CRUD apps in PHP - a handful of database tables, and a PHP file for each URL that acts as a thin glue layer between raw SQL and HTML presentation. These are some of the easiest Web apps to understand - which is not to say that they are actually easy - and they are a good place to start.

By contrast, learning something like Rails requires a big up-front investment. There are objects. There's a database and an ORM. There's an MVC framework. There's an abstract mapping between URLs and the methods of your controller objects. All of this makes great sense once you can see the big picture, but to a brand-new programmer PHP must look a lot less intimidating.

"There is a well-worn path for beginners in PHP, with baby steps and encouragement all along the way."

Down that path lies madness. I've seen the newbie-focused tutorials for PHP, and it explains a lot of the garbage that passes for software in the PHP world. It is entirely possible to write good software in PHP (I'm reasonably impressed by the Dokuwiki and Flyspray code, for example), but you have to learn the language at least twice to get to that point. You learn it as a newbie, and learn horrible practices from the vast collection of misguided "help" in the Internet. You produce lots of code with those horrible practices...like no DB abstraction, inappropriate or no use of objects and encapsulation, and "gradually mix PHP into your HTML" design. And then you realize you've built an unmaintainable mess and start rewriting it with all of the better practices that have since been bolted on to PHP.

Of course, despite all of that I still recommend PHP for a large classes of application because it is pervasive, hard to make pathologically slow (whereas Ruby and Python can be made pathologically slow even by really good developers--see Plone for an example), and has a pretty large selection of libraries (some are so bad as to be counter-productive, but many are good). But as a newbie language it's rather toxic.

Compare to mod_perl circa 1997/8/9, any of the Java stuff... Python didn't have anything that great. ASP was probably fairly easy, but limited to Microsoft. The Tcl guys could have competed, but screwed things up and didn't release much as open source until after I created mod_dtcl, which turned out to be too little, too late.

With PHP, it was and is very easy to get started. I wrote about it here some:


What's not to hate? It's not very powerful (lacks first-class functions, for example), it's messy (just look through the function reference), it's weakly typed (try performing multiplication on a string), it's fairly insecure by default and it's simply ugly. It may be convenient to be able to start by inserting a few blocks of PHP in to an existing web page, but you can do the same thing just as easily using Ruby and RHTML.

If you sit down at a randomly chosen web server and write two files, one ending in .php and one ending in .rhtml, which file do you think has the better chance of working correctly? Newbies would prefer not to know what CGI means, let alone how to edit an Apache setup file.

But, yeah, PHP is a scary language. In addition to what you've already mentioned, PHP's core "array" datatype appears to have been designed by a committee of drunken camels.

I would not expect someone trying to learn to program to select a web server to test projects on randomly. Installing mod_ruby is as easy as installing mod_php. Finding web hosts that support it isn't hard either.

Plus, there are Ruby on Rails packages that don't even require apache! You just download the package, install it, then you can run a built-in development webserver by typing "script/server". What could be easier?

(OK, I know of one stealth mode startup that's going to make it even easier, but that's beside the point.)

If you do want to take a shot at becoming a "full-fledged hacker", here's a great way to start: http://mitpress.mit.edu/sicp/full-text/book/book.html

SICP uses Scheme (a Lisp dialect) and falls under the "deeply understand but not practical at the start" category.

Here are the languages that have big communities: Perl, Python, Ruby, PHP, Javascript, C#/VB.NET and Java.

Subscribe to lots of blogs from each community. (Many of them have planet aggregators like "Planet Python" and "Planet Ruby".) Also visit local user groups, wherever your are.

Read/visit them for a while -- say a month or two. Whichever community makes you go, "wow, that's cool" -- join that community and learn the language. You can also interact with those communities via Google Groups.

Lots of people will say -- "that's easy" or "this is elegant" or "that language sucks". Feel free to ignore them.

Excellent advice. Non-religious, informative, and true.

Python is certainly a good one (ruby as well) - "Learning Python" by Lutz & Ascher I think is suitable for someone like you (and it is not a bad reference as you get more experienced). Ruby can be a bit stranger, people like to be "clever" in ruby, and then there is the hype.

As for mind expanding, I like scheme - as taught by MIT in the SICP series (you can watch the videos on google video). It would be interesting to see that taught to someone new to programming (sorry to make an experiment of you !).

As for practical messy stuff, then look into Java (for basic static strong typing and endless tools), Perl if you must.

Another angle: Haskell seems to be popular for functional programming (as it is pure) - many people think functional's time has come, and there are some useful videos introducing it here: http://sequence.complete.org/hwn/20070807

Stick to things where you can get all the tools you need for free on the platform you use (and they are easy to get running).

Alright, as much as I love Haskell, do not attempt to learn it as a first language. Repeat: do not attempt to learn it as a first language. That's like learning to swim by taking a submarine into the Marianas Trench and then opening the airlock.

I wonder if Haskell is as hard for first-time programmers as for experienced ones, though. There are high school kids in #haskell that know way more and probably have an easier time learning than I did. They don't have any bad habits to unlearn.

Also, many "tricky" Haskell concepts (algebraic data types, lexical closures, first-class functions, programming without state) are actually quite logical if you've never been exposed to the C/Java way of programming.

I don't agree that exposure has anything to do with it. Its like saying being a viola player makes it harder to pick up the guitar (as you are tranposing strings/notes in your head). Yeah for about the first day it may be a bit strange but once you get past that it is not a problem.

Miranda was the first language I ever learnt. I am the only person who I know who learned a strict functional language from the get go. And yes, it scared and confused the heck out of me :( I am not sure if it helps, but at least I (only now) have a appreciation for the mathematical side of functions/functional programming (has taken me 10 years to get here though).

The highschoolers on #haskell have some unusual activity going on upstairs. I knew ihope from userfriendly.org before I came to #haskell, and always assumed he was a grad student somewhere. I literally fell out of my chair when I found out that he was 13 years old.

I'm learning on Lisp, and it's kind of weird. I'm using Practical Common Lisp (http://www.gigamonkeys.com/book/) and I have to reread chapters a few times to really understand them. I downloaded Lisp in a Box for it, and that is weird because it's rickety. The tutorial isn't there, and it will keep kicking me out of the SLIME.

I'm in the middle of a four-month vacation, but progress is pathetic. Lisp in a box and Practical Common Lisp aren't helping me stay on task. The look like they're made for guys who are learning their sixth programming language.

If you're looking to learn Lisp, try to find something ostensibly beginner-friendly.

I love that book, but I have to agree with you: it's intended to teach Lisp, not programming. If you don't already know how to program, you probably won't learn programming or Lisp from PCL. Instead, you're likely to get turned off to both.

The Structure and Interpretation of Computer Programs is a great book for learning the fundamentals of programming. It happens to use Scheme, a dialect of Lisp. If you want an academic introduction to programming, it's one of the best. I haven't found anything as good that takes a more pragmatic "let's build something useful/fun and learn to program in the process" approach, but I bet someone else here has.

Thank you, Zak. I'm going to look into that book.

You really need to have a problem in your mind that you want to solve. That makes the task a lot easier. As you can see progress.

Test out that understanding. I bet you know more than you think you know. The purpose of a book like PCL is to be a reference. Scan it properly and go back to it when you need to find something. Intially it will take sometime, then your brain will learn and you won't be looking up so often.

You can't learn lisp with PCL. You can marvel and say ohhh Lisp can do that kind of stuff! But you can't really learn the language with a handful of pre-made examples.

To learning lisp I recommend: http://www.cse.buffalo.edu/pub/WWW/faculty/shapiro/Commonlis...

Notes: YOU HAVE TO DO ALL EXERCISES. Just reading the book teaches you very little.

After this, you can go and read On Lisp (the Uber-Programmer Lisp book) and understand it perfectly in the first read.

Python is the easiest to learn.

You can also try Lisp, but I don't have much experience with it. Lots of video lectures here: http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lec...

The argument is that there are things you can do in certain languages that you can't do with others. This is important because you're taught to think in the capabilities of the language, meaning you won't even know what you're missing in a less powerful language.

If you want to do things right, read SICP and learn Scheme. That's probably the fastest route for going from knowing nothing about programming to being a very good programmer. It's somewhat akin to learning to swim by jumping off the 10m platform, though, so don't get discouraged.

OTOH, he doesn't say he wants to be a very good programmer. He wants to be able to communicate better with other programmers. SICP helps if he wants to talk with the right programmers. :) Otherwise, it may not be the most cost-effective investment.

I don't think learning programming is the best choice, because it's too easy to get caught up in the details of learning syntax, api, etc. I suggest working with a programmer on real projects and learning how to communicate between each other. If you're not a programmer by nature, which takes A LOT of practice to get good. You'll only become annoying since your suggestions will be uninformed. Learn to give creative suggestions at a level of abstraction, without stepping on a programmer's toes.

Re: people around here recommending The Structure and Interpretation of Computer Programs (SICP), I'd warn a newbie that it may be a demanding way to start, and I've had trouble encouraging former coworkers (some with way more experience than me) into reading it. But don't get scared a priori; skim the preface and the 1.1 section to see if it's for you.

Even if it's for you, you may want to check out The Little Schemer first. It's an easy, wonderful and enjoyable way to get introduced into programming. Don't spoil it by looking elsewhere first. :)

[Edit: How to Design Programs (HtDP) is probably a good one to try after The Little Schemer. That one too is best if you read it as a beginner, because it tends to hold your hand a lot, and you'll have less patience for that when you consider yourself more expert.

These three books are a strong reason to consider Scheme.]

Given your current motivation, I think you'd be better off figuring out what kind of languages the programmers you'll be interacting with use, so you don't learn something that is too different.

If you don't know those programmers yet, do you know anyone that could mentor you, or at least anyone who you could bug with questions often enough? If so, ask them about what language they'd be most comfortable helping you with. Having someone to rescue you when you get stuck will probably help you more than any qualities of the languages themselves.

Failing all of the above, and if you can't get over the notation of Scheme, you can't go very wrong with Python. It's a piece of cake to get started with, it has a great joy to WTF ratio, it looks less alien than the Lisps for most programmers, and it's a very practical and powerful language for the future.

I wonder how many people that recommend SICP have actually learned to program from it or even read it. I did way back as in undergrad (with severe MIT envy) and I would not recommend it as a first book for beginner programmers. Also, I wouldn't recommend Lisp or Scheme as first languages to use for beginners wanting a taste of the practice (despite how much better off the world would be if we all programmed in Lisp :). Unless the questioner is a math (or idiot) savant, I would only recommend these as first programming languages to someone if I wanted to scare them out of the profession or didn't really like them.

Today, I would probably recommend JavaScript with the browser DOM.

In my experience, to normal people who are simply math students, but without any previous programming experience, C syntax is ugly and Lisp syntax is clean and beautiful.

Lisp is so much easier for them, that I think that your statements do not take into account familiarity and most people are just being too used to a particular syntax.

SICP is a hard book to read, however. There are much easier books to learn Lisp.

If you are serious about learning to program, Im gonna have to recommend C or C++. Many people may recommend that you start out by learning a scripting langauge, but these languages have many weaknesses. I'll use python as an example. Python is an easy language to learn, but it is also a softened and simplified language aimed for ease of reading and writing efficiency, not performance. Python runs about as slow as Java (which is quite slow), making it hard to run complex and especially recursive algorithms. The OO in python seems very fake and inflexible, and as they say, it feels "tagged on".

At first, learning a fully-fledged programming language may seem difficult, as there are all the blocks that you have to simultaneously put in at the right place. But after the first few steps, you will be surprised at the power of the computer at your command. C/C++ also forces you do develop good programming standards and habits, both of which play an integral role in your working efficiency.

I myself learned C++ as my first language. Yes, it was hard at first. But the payoff now obviously outweigh the initial difficulties.

Just curious, but would anyone recommend Javascript?

That's an interesting suggestion. On one hand, you get a decently powerful language with most of the benefits of Scheme and without the scary (non-)syntax. However, I have to go with "no" because Javascript is tightly coupled with so many messy real-world details like DOM and browser incompatibilities. You end up with just as many brackets; they just happen to be a little pointier. It would be a good choice for someone already comfortable with HTML and web administration. Otherwise, you have too much static friction to overcome before you get to Hello World.

Maybe. On the plus side, it's a pretty nice language - somewhere between Python and Ruby on the power continuum, I think. The C-like syntax is more complicated than Python, Ruby or Lisp, but familiarity with C syntax is probably advisable for anyone trying to get an overview of programming in today's world.

Implementations and libraries are a drawback. I think the best way to learn a language is to build something interesting using it, and the only thing that's easy to build with Javascript these days is the client-side part of a website. Doing that also requires CSS and HTML, which the OP should probably learn a bit about, but it might be distracting to do that while he's trying to learn the fundamentals of programming. Trying to learn Emacs at the same time I was learning Lisp was distracting for me. I don't think browser incompatibilities are a reason to shun JS; unless you're building something for a website used by the general public, just target Firefox. Use Firebug to learn what's going on with your code and track down problems. Once you know what you're doing, it's more tedious than difficult to get it working on other browsers.

If you already know how to make web pages, or really want to learn, JS is probably a good choice. If not, it probably isn't. It's probably best to can figure out what sort of project you'd like to build, and then learn a language well-suited to building it.

It's possible to use Javascript for other purposes, but it's not yet easy. In a couple years, that might change - Steve Yegge seems to think it's the "next big language".

JS is better as a second language, because of DOM issues. It's better for a beginner not to have to worry about those. It is very convenient for beginners because it's built into the browsers, and many people learn it concurrently with something else. You could do a lot worse than JS.

For a first language, look at Python/Ruby and choose what you're most comfortable with.

If you're absolutely new to web programming then the first thing you must learn is HTML. Some may think thats a given, but I think it's important to point out. If you can't get your head around HTML, you're not going to be building websites.

Funny you ask.

I happened to listen to a talk Marc Andreessen did called , "2005: A Web Odyssey" <http://osc.gigavox.com/shows/detail994.html>; where Andreessen talks about commodity hardware and how it effects programming language choice.

"... programming has moved from being machine dependent and complicated to become a dynamic and easy-to-learn process ..."

Andreessen talks about how languages are moving up the ladder from machine languages to "high level, dynamic languages" by looking at increasingly comoditised, powerful hardware. He notes that Java should now be thought of as a system language. JS in browsers was created in '95 to bridge the gap b/w HTML & Java. Java was deemed too complicated for HTML users. The original idea was JS to be server side. But it never took off due to lack of effort by Netscape to create an Open source version and the tool problems.

"PHP is to 2005 what Java is to 1995"

A lot of the talk he talks about how "PHP is to 2005 what Java is to 1995" The talk was done in 2005. So for Andressen PHP or PHP like languages (Ruby, Python etc) are what he suggests. But right near the end of the talk he talks about Sajax and JPSpan where server side PHP (python,perl) transparently talks to higher level JS code in the browser.

You can find more about Sajax and JPSpan following:

- Sajax http://www.modernmethod.com/sajax

- JPSpan http://sourceforge.net/projects/jpspan

I would. It is high level enough for someone who wants to grasp basic concepts about programming (flow control, basic data structures) and has a really low barrier to entry (a web browser is all you need) which results in lots of online material.

And, as the learner makes progress, he can start to go deep into the functional side of the language.

It seems to be a nice fit for the case, indeed. Python would be my second best.

Javascript was the language I learnt with more or less. I think it's quite a good choice, but it is very easy to write "bad" Javascript, especially when it comes things like eval(). It seemed wonderful when I first discovered it, but not until some time later did I discover the kind of mess it can cause.

I was also introduced to OO (of sorts) through JS... I perhaps wouldn't recommend this so much, it was incredibly confusing for me at first. I didn't have any real grounding in OO principles before I started though, so perhaps that would have helped.

The only reason I wouldn't recommend it is because the vast majority or books / tutorials available don't teach how you can really use it. Douglas Crockford and a handful of others have been beating the drum about Javascript being a functional language, but I don't think it's at critical mass yet.

I think most people starting out with Javascript would learn how to do stuff in a browser but not how to "program".

I just ran across this thread randomly -- far too late -- but, yes, I would. In a <cough> concurrent thread, I gave my thoughts on why I'm glad I learned JS first: http://news.ycombinator.com/item?id=46531

Functional JS rocks. And the fact that you can examine other peoples' programs with FireBug is huge.

Tricky answer. Javascript is beautiful, but not the DOM, and as have been said he would need to learn at least some HTML.

On the other side, using only Javascript with a stand-alone interpreter would be a nice.

I would go for Logo.

[edit: a couple of spelling mistake]

pg, would you recommend js?

I don't know enough about non-Lisp languages to recommend one.

If I knew them well enough to choose one, my pick would be whatever makes it easiest to write simple programs. Building confidence is the most important thing, not conceptual elegance. I wrote most of my first programs in old fashioned Basic. It was a kludge of a language, but it was good for writing the dumb little programs I started with. The worry that people will form bad habits from using ugly languages is overblown.

JavaScript probably fails miserably on the "easiest to write simple programs" count.

The development environment is easy to find, obviously...any browser and any plain text editor. But user interaction is hard, and gets all mixed up with nasty DOM and browser incompatibilities in short order. You also have to have additional tools (like Firebug) to get anything resembling useful errors from JavaScript.

A good modern learning language probably ought to have an interactive shell. Ruby, Python, Scheme, and Smalltalk are probably all good choices. JavaScript can have an interactive shell in the form of FireBug...but again, it's scary when you get to doing anything that interacts with the user and very few tutorials of JavaScript cover interacting with JavaScript interactively. Having the knobs do something immediately when you twiddle them is almost certain to speed up the learning process. The human mind is pretty good at abstract reasoning: "flipping this light switch causes the light to come on over there". But the more you separate things out temporally and the more variables involved the less they stick: "flipping this light switch starts a timer, which depending on the current state of the light, will cause it to turn on or off in three minutes".

Merely being a non-compiled language is still a slower iterative process than direct interaction (which is the primary disqualifying point against Perl as a learning language in my opinion...corrected in Perl 6, of course, but that's still a few months out). The shorter the "try, debug, try again" cycle is the faster one picks things up, I think. I found Ruby very fast to learn, to some degree, for that reason. Python was almost as discoverable, though I found it less intuitive, where "intuitive" is probably defined as "kinda like what I'm used to". PLT Scheme was a pretty cool learning experience, but it became less interesting as soon as I wanted to build something useful with it--so few libraries (of course, as a Perl user, I feel that way about every language other than Perl...CPAN spoils you for all other languages when it comes to "just get it working" prototyping).

We don't really need the browser's implementation of Javascript. For example, consider Steve Yegge's rails port to JS which he developed on top of Rhino (the mozilla engine.) IIRC, rhino includes a very basic shell.

Ah, but then you have to have a JVM, so "having Rhino" is a challenge. But I guess if you're not on a UNIX system where Perl, Python and Ruby are pervasive and always available (or a couple of clicks or commands away), then having Java around is just the same amount of effort. It also lacks "beginner" tutorials that are focused on the kind of interaction that you need to understand to build applications. JavaScript is a weird interactive model, because you are talking to the DOM to do anything interesting, which is a mess--it's really way more complex than beginners usually grasp (I have a hard time with it, and I've been developing in several languages since I was a kid).

That said, I think in the end JavaScript is going to be the world's most popular language for almost everything, including web applications. I happen to agree with Yegge in that regard. But it's still somewhat less friendly to learners than the other languages I mentioned.

Anyway, if Rhino (or some other standalone JavaScript engine) becomes popular I'd reckon that in a year there will be some good tutorials for interactive JavaScript, and it'll become a great choice for learning programming. I happen to think JavaScript is a very pretty language. A few confusing quirks (Function vs. function vs. = {}(); modules, for example), but overall it offers some great functionality in a pretty simple syntax and low keyword manner.

Scheme worked wonderfully for me on this criteria. Even if it looks scary, as a newbie, I felt I knew what the interpreter was doing. This built my confidence much more than putting a lot of power in my hands that I didn't understand, like some other languages I tried first.

Scheme is awesome as long as you are mathematically fearless enough to learn from square one using books like How to Design Programs and The Structure and Interpretation of Computer Programs. They provide a great foundation if you feel right at home in math, and you're not too concerned with building something practical for your first project.

For people who aren't as confident in their math, I would recommend Python, as other have mentioned. It's thoroughly friendly to newcomers, there's tons of good documentation (the free tutorial written by Guido is incredible), the libraries are among the best available, and, like Scheme, it's easy to start by biting off a manageable chunk and then gradually learning more details as you go.

Pick language X. Buy Learning X from O'Reilly, e.g. http://www.oreilly.com/catalog/learnperl4/

I don't think it matters that much what you start with unless you have something in particular in mind you want to do, in which case, no matter what it is, choose Perl :)

Don't forget that .pdf's of popular books are available from your favorite neighborhood torrent search.

I'm teaching my 14 year old nephew programming, and I chose Python. Why? Because it's interpreted, so you get the instant gratification of writing command line programs. You also get IDLE bundled with the .exe (on windows) which shaves a bit off the text editor learning curve a bit.

Also, I think that Python's beginner documentation is better than Ruby's. The beginner books for Python are a bit easier to follow than the Pickaxe book. Sure, Why's Poignant Guide is fun, but unless you understand programming already, you'll probably be lost.

Ruby does have HacketyHack, which is fun and the tutorials are really well written, but it's still a little buggy. Some of the code examples in the tutorial are broken, causing a lot of frustration for a young noob. In another 6 months or a year, I'd suggest Ruby and HacketyHack, not right now, though.

Personally I think Python is easier to learn than Ruby; it takes a while to wrap one's newbish head around blocks, which are fundamental in Ruby.

I found the opposite to be true. Objects in Python are uncomfortable for newbies, while they are very intuitive in Ruby. Both are fine learning languages, however.

What is uncomfortable about Python objects? If it's the explicit self in methods, that will only bother you if you come from a language that implicitly pollutes the local method namespace with that of the object.

Explicit self drove me bonkers with Python, and still does.

Am I the only one who would suggest a more rigid language like C or Turbo Pascal? (am I showing my age here?)

C is rigid?

Compared to something like Ruby, it's a lot less forgiving.

There's no such thing as a forgiving language. If your program is wrong, it won't work.

Not really. Your program can work for the wrong reasons, if you don't understand what the language is doing.

In C, if you're wrong, chances are your program either won't compile or it'll give you a nice segfault or bus error.

In something like Javascript, you can easily be "wrong" every time because you don't understand an aspect of the language, and still have your program "work" 9 times out of 10.

If your logic is wrong then yes, it doesn't make a difference what language you're using, but that's not what I was talking about.

Do want to learn Web programming? PHP is probably the easiest programming language to learn for server-side web programming. I've read several books on PHP and looked over a bunch, and a lot are pretty good, but one of the best is this one: http://www.amazon.com/PHP-MySQL-Development-Developers-Libra...

come on, let's not get in the habit of modding someone down because we disagree with them.

I'm modding it down to save anyone from being misled into PHP.

PHP is awful.

It might be awful but it works well and is easy to learn.

Yes, but it'll teach you terrible habits.

Like what?

Dumping things into global variables. Using regexes to hammer anything vaguely resembling a nail. Thinking in for loops when you should be thinking in higher-level abstractions.

That may have been the PHP of old and sadly it is still practiced up to this day. But I'm telling you man PHP5 and it's implementations will blow alot of criticisms out of the water.

Python is certainly a good one (ruby as well) - "Learning Python" by Lutz & Ascher I think is suitable for someone like you (and it is not a bad reference as you get more experienced). Ruby can be a bit stranger to newcomers (in my opinion), people like to be "clever" in ruby, and then there is the hype (this is my personal opinion - although I find ruby much easier to use myself, and its OO approach suits me a bit more then python).

As for mind expanding, I like Scheme - as taught by MIT in the SICP series (you can watch the videos on google video). It would be interesting to see that taught to someone new to programming (sorry to make an experiment of you !). Someone tried to teach this stuff (kind of) to me once in miranda (didn't work to well as a first programming language).

As for practical messy stuff, then look into Java (for basic static strong typing and endless tools) and Perl if you must, the basics of C to wrap your head around pointers may help - I learned that around the same time as motorola assembler (much nicer then intel) and it helped form a mental model of 'on the metal' computation which I found helpful.

Another angle: Haskell seems to be popular for functional programming (as it is pure) - many people think functional's time has come, and there are some useful videos introducing it here: http://sequence.complete.org/hwn/20070807

Stick to things where you can get all the tools you need for free on the platform you use (and they are easy to get running).

If I ever have children I'm planning on introducing "programming" through digital logic simulators, viz, "How to add numbers using transistors". This sort of thing has been done before:


...but I think it's more suitable when kids are younger. If you're old enough, you probably want to get web pages up and running faster than you could with bare wires.

Hear hear! This is the best approach, IMHO.

The language doesn't matter that much. But read a good theory book on programming. I like "Code Complete" 2nd edition. You'll get all the info on how to be a good programmer.

Mainly, concentrate on learning the technology and not a programming language. Programming languages are just tools for a specific job. By technology I mean, web programming, server/client, application, embedded, etc. Each industry has it's own language and you have to know the technology to speak their language.

Best Option: Figure out what program you want to write and then find out which language you should write it in.

Objective-C and Cocoa are going to be your best bet for learning application programming, but you have to have a Mac. Otherwise, learn Java. It's somewhat simpler than C/C++ because of memory issues.

Microsoft stuff is not an option as it will teach you very very bad things.

If you want to be really hard-core, learn C++ and Assembly ( x86 architecture ). But to be even half-way decent at those will take a lot of time and a lot of reading on how to do it right.

Conclusion: Buy a Mac and learn Cocoa :)

Code Complete is not a theory book, and of course no book has all the info on how to be a good programmer.

That book doesn't teach you to program. It is a survey of 'best practices' that may help someone who already has some proficiency.

Learn whichever language is closest to your application. If you want to make a blog, go take a look at some blogging software already out there and learn the language it's written in. (Wordpress -> PHP w/ HTML & CSS just because they're always helpful)

Then, once you've got your feet wet, learn another one. I feel like I never understood one language until I could compare it to another.

Python and Ruby are great for hammering out functionality and learning. Common Lisp/Scheme are great for widening your perception of how problems can be solved. I don't want to say much about C because I'm not proficient with it, but it definitely gives you a closer feeling to how your computer runs your code even if it obfuscates the problem a little. Learn Haskell/OCaml when you're feeling lucky. They will break your brain and then rebuild it in crazy, inventive new ways.

Which ever language you pick, try and pick up a book which shows you how to do functional programming in it. Try and do this before you start writing imperative programs.

It's easier to go from functional to imperative than to go from imperative to functional.

Do you have a friend who is a programmer who will be able to help you setup an environment so that you can write hello world? Then choose the language that she knows.

Like learning anything new, I want to pick a safe first choice where you can spend time building confidence. As soon as you have a bit of a foundation then explore other choices.

Personally I would recommend scheme. The little schemer is an exceptional book for a newbie and I think it's not hard to get scheme setup.

If you want to learn to program then C. That's right learn C. C is the language that the operating system you're using is written in, not to mention several of these other programming languages (the main implementation of Python or Ruby, for example). Is this language easy? No. Is it right for newbies? Maybe, maybe not. If you want the least amount of abstraction and don't want a bunch of stuff in your way, learn C. It's a hair's breath from learning assembly, and you can get a free compiler for it on any operating system.

If you want to get stuff done quickly, learn Python or Ruby.

Having programmed in both C and assembly, I wouldn't say "a hair's breadth" is an accurate characterization. It looks like a high level language, and it's easy to use it like one. But it's equally easy to misunderstand C's semantics, they're often subtly different from what you'd expect. An obvious example is the array[index]. There are complicated syntax rules required to do some fundamental things, such as passing parameters by reference. Strings are a nightmare, and of course don't forget malloc() and free().

I only recommend learning C first if you have handy: an excellent instructor or an excellent book-- preferably both. I might also recommend C if you already know a lot about how computers work architecturally but don't know much about languages.

With python and ruby, just go to www.python.org or www.ruby-lang.org. Several good resources have been mentioned for Scheme. In those cases, you'll get familiar with the basic idea of telling the computer what to do, as well as fundamentals like expressions and abstractions. Going the SICP+Scheme route will introduce you to recursion and high-order functions fairly quickly, while Ruby and Python have all sorts of practical libraries. Interpreters for Javascript are more readily available than C compilers, though at the moment I can't recommend an ideal place to go learn about it. JS is everywhere though.

I love C, and think that an undergraduate Computer Science curriculum should require learning it early on. But for someone who wants to learn to hack on their own, C is probably not the best choice.

I'm surprised that people disagreed with my C recommendation (although, note that I did say Python or Ruby if you want to get something done quickly). Learning C isn't really about learning C, it's about learning how the computer actually does things (aka pointers, memory management, etc.). Knowing C lets you understand concepts in higher level languages easier. For example, "pass by reference" is easy to understand once you have passed around some pointers. It helps you understand what the garbage collector is doing, and why it's doing it. It helps explain why even in managed languages sometimes you need to "free()" something (an example is bitmaps in C#).

Would you rather start programming on the surface (not knowing what is happening underneath) or would you rather start by learning the hard stuff underneath? I, personally, would rather know what is happening underneath. Is there an argument for learning the more surface stuff first? Maybe I'm off nuts and have a slanted view because I learned Java, Scheme and then C.

Don't listen to him!

C is a valuable language for a large class of problems. But don't learn it unless you want to be a real serious systems-level software engineer. If you just want to write software for the web (even large-scale apps), don't waste months on the intricacies of pointer arithmetic and memory management.

That said, I learned C, and it didn't hurt me any. But I doubt it really helped much either.

I would go with Ruby, Python, JavaScript. You might want to even look at some Lisp dialects, maybe you are one of those people who sees things more like Church than Turing.

They are all comfortable, require a pretty small platform, and provide some instant gratification...the excitement of seeing your code come to life as you type! I think if you simply want to interact with developers, understanding the thrill of creation is more important than knowing what to create.

If you are a non-programmer, give this free book a try: "How to Think Like a Computer Scientist" ( http://www.ibiblio.org/obp/thinkCSpy/ ). As it explains in the Preface ( http://www.ibiblio.org/obp/thinkCSpy/preface.html#auto2 ), Python makes things easy to learn.

If it's for the web only, nothing beats PHP right now in terms of speed and deployment (especially if you're on a budget and need to scale). I'll probably get a lot of flack for this, oh well - but PHP isn't as bad as people say it is provided you take advantage of OOP and separate your logic from presentation.


The question is moot. The concrete language isn't important. What's important are the thought processes and techniques behind program construction. Unfortunately only a few beginner books put the language in the background.

My recommendation: Get the book "How to Design Programs". You can check it out at www.htdp.org first.

The concrete language is important because there are languages that are more/less suited to be put in the background.

Dare I say Java? Seriously though, Java is a good programming language to start with. You get used to C style syntax, but don't have to much with memory management and architectural differences. Plus you can use Eclipse, a great IDE, for free!

I think learning Java is a great way to get turned off to programming. There's just too much busy-work you have to do before you can actually do anything interesting. Pick a language where Hello World is one line.

I agree with this. I also think that the REPL of Lisp, Ruby's irb, and Python's IDLE are very valuable for the new programmer. I knew a few languages when I hit graduate school, but I ended up doing most of my "programming" in Matlab because of the interactive shell. When I first picked up Python and later Ruby and Lisp, I was delighted by the interactivity. The instant feedback, even when it's negative, just feels more forgiving than compiler errors, and the whole process of trying things out at a prompt feels more like learning than code/compile/run.

great way to get turned off to programming

Not that it really matters (this is pure religion after all) but the sheer numbers of Java programmers suggest the exact opposite.

Eclipse is a great IDE once you get used to it, but I spent many days bewildered even though I was already fluent in Java when I first tried it.

Python. It's elegant and easy to learn. Especially you have no programming experience before, you can think python way more quickly before other language pollute your head:)

Nearly all software is this world is written in C. Web is 95% powered by C (Linux, Apache, MySQL, Windows, IIS).

Everything else is just configuration :-)

www.hacketyhack.net is an integrated environment for learning ruby, the hardest part of learning ruby is setting up ruby on a web server.

Ruby or Python? I'm getting mixed signals!

Try both and see which one feels better. For what it's worth, Ruby programmers are more in demand than python programmers.

"For what it's worth, Ruby programmers are more in demand than python programmers."

Only in one small segment of the industry (the one that hangs out here). Python jobs in almost every other area are more common. And, of course, Perl is still more popular than both. And PHP and Java and C# dwarf all of the interesting languages.

Are startups still fighting for Ruby programmers in the Bay Area?

The dumb ones are.

I'm not saying they're dumb because they're using Ruby. I'm saying they're dumb for hiring based on one language on the resume. I'd hire a great Python/Perl/Java/Lisp programmer to work on a Ruby app before I'd hire a mediocre Ruby programmer. In my own experience, I've seen a great Java developer become an amazing Python developer in the span of a couple of weeks...while a mediocre Python developer could remain a mediocre Python developer for the rest of his days, even though he may have years of Python experience. Being a good developer knows no language boundary (within reason), and the same is true of mediocrity.

When I saw the Auctomatic guys at demo day, they were talking about how easily a Ruby guy they'd just brought on board picked up Smalltalk (obviously the Ruby to Smalltalk gap is smaller than most languages, but the point still stands). Hire good developers, not good X developers, where X is the trendy language of the moment. The language(s) will take care of themselves.

brilliantly said.

It seriously takes minutes to pick up ruby. In any good team, any decent developer would be productive by the afternoon.

And honestly, who hasn't really looked and noodled with ruby, even if their day job has nothing to do with it (its probably the sign of a decent programmer really isn't it).


Here's a good starting place for understanding concepts:


What about symfony-project.com (symfony) PHP framework for creating webapps similar to Ruby on Rails?

If you want to get stuff done, Python.

If you want to understand how the computer works, Assembly.

And if you want to understand how computation works, Scheme.

I recommend to learn object-oriented programming with c++

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact