News for hackers. Stuff that matters.
Re:Ask HN: What's a good programming language to start with? by ErrantX on Thursday August 13, 2009 @05:51AM (#760396)
I'd actually suggest giving Python 2.6 a shot. It's not significantly different BUT in some aspects I think it is a little easier to learn.Incidentally I find the Activestate Programming Network (ASPN: http://aspn.activestate.com/ASPN/Python) a really useful resource for python learning - especially the cookbook.

PHP might be good to learn (so long as you avoid the bad habits it invokes) if you interested in web programming. I know others might scoff a little at that suggestion: but the online documentation is stellar and you can pick up the basics in a few weeks.

C is also hellishly useful because it will teach you some core concepts. In fact I would poke around in C anyway whatever you choose - just for "background".

Re:Ask HN: What's a good programming language to start with? by caffeine on Thursday August 13, 2009 @07:15AM (#760494)
Depends on what you want. Option 1: web hacker guy (doesn't take long). Option 2: skillful, reasoned programmer guy (takes way longer).

Option 1. Python is not a bad choice, and neither is Ruby. In either of those languages, in a couple weeks, I'd say you can write yourself a "Guestbook" or something. Spanning the Gamut of "Web 1.0 apps" like forum, guestbook, blog/cms, etc. in a language is a nice easy way to get the basics.

Completing option 1: You can hack together simple web apps. A bit more effort will get you enough Javascript to use jQuery.

Option 2. Start with Scheme. Check out HTDP and/or SICP (google the acronyms). You can write real, useful programs in Scheme and/or you can move into Clojure, which lets you write anything you could write in Java (i.e. the libraries are all available). Spend some time here - write some simple games, and then maybe a web app with the existing frameworks. Consider picking up a language in the ML family, or Haskell, to learn about purity. In fact - with Clojure and e.g. Ocaml, you've got enough speed & flexibility than you probably never need to learn anything else. But...

Next, learn C. C is a great beginner's language for imperative programming. It's less ulcer-inducing than assembly, but you're still close to the machine. You'll want to implement a book of basic CS data structures and algorithms in C, and deal with all the thorny issues involved in making them fast and stable. In particular, you'll notice that cool data structures are really just different ways of re-arranging pointers. Conversely - by re-arranging pointers, you can do a LOT of cool stuff!

Eventually, you'll have to learn about OOP despite all the functional craze these days, so go to Java. Much of the online literature about OOP was written for Java. Go to Java before C++ - but eventually, get to C++, because everybody uses it.

At the end of option 2, you will have a good layer of fundamentals. You will hopefully have done at least 1 or 2 projects in functional, close-to-the-metal, and OOP environments. Hopefully, you will have gone through and implemented the standard CS algorithms/data structures in each one, understanding the subtleties therein. You can confidently go on from here to learn the skills how to write video games, databases, trading platforms, custom server apps, etc.

Re:Ask HN: What's a good programming language to start with? by dkersten on Thursday August 13, 2009 @06:03AM (#760414)
I would choose Python and Django over PHP, just because its very VERY easy to fall into the "bad habits" trap with PHP.

C makes an excellent (and important) SECOND language, but a pretty terrible first, IMHO.

Re:Ask HN: What's a good programming language to start with? by jokull on Thursday August 13, 2009 @06:39AM (#760463)
Starting with Django is a bit like learning to snowboard. No pleasure just pain for the first days. Once you get the hang it's bliss.
Re:Ask HN: What's a good programming language to start with? by dkersten on Thursday August 13, 2009 @07:34AM (#760514)
Totally agree. My first day or two of snowboarding were painful. A lot of falling, horrible balance, sore knees... then after a few days I got the hang of it and suddenly it was the most amazing thing ever.

Django is the same. Until you get an understanding of the basic concepts, its painful and annoying, but once you do, its a breeze and you'll have a lot of fun.

Re:Ask HN: What's a good programming language to start with? by ErrantX on Thursday August 13, 2009 @06:41AM (#760470)
I might bear that in mind andf give it another shot. I much prefer PHP for the area's Django seems to be useful for simply because it was painful to get into!
Re:Ask HN: What's a good programming language to start with? by jokull on Thursday August 13, 2009 @08:15PM (#762057)
It doesn't really feel like you're getting anywhere the first couple of days because there are so many things to get right and learn about. Hang in there, check out the Django book and read tutorials that teach you cool stuff (balance between taking small steps and seeing cool stuff to look forward to).

If you're feeling adventurous check out virtualenv right away (Python not Django specific)

Re:Ask HN: What's a good programming language to start with? by mechanical_fish on Thursday August 13, 2009 @09:13AM (#760675)
its very VERY easy to fall into the "bad habits" trap with PHP

This is like telling someone that they shouldn't buy a tambourine because it won't help them learn to conduct the London Symphony.

Mind you, I'm not saying that your first 10,000 lines of PHP code won't be filled with bad habits. I'm suggesting that your first 10,000 lines of code will be filled with bad habits whether or not that code is written in PHP. The secret is to keep practicing and learning.

As a language, PHP is not as good as Ruby or Python. It's less flexible, less elegant, and has less expressive power. But I assure you that placing a flexible and elegant tool in the hands of a beginner doesn't magically give them good habits. You can write ugly global-filled procedural spaghetti code in Ruby, and that's exactly what beginners are likely to do, unless they have a great teacher looking over their shoulder and correcting them. And how many people do? Most programmers are compelled to teach themselves, because their teachers either don't exist or are hung up on Java, an absolutely awful beginner language. That's why so much of Web programming is done in PHP, a language which has evolved to be very easy to teach to oneself.

I have reluctantly concluded that, if you force a self-taught beginner to start with Ruby or Python, all you do is add that much more friction to their learning curve. These languages are harder for a beginner to work with, in part because they are so flexible and general-purpose. Everything about PHP is relentlessly focused on the goal of getting your web page running -- it's got one use, it's got a canonical set of docs, everyone's Hello, World looks the same and can be run on an $8/month shared host in five minutes by following a simple recipe. Python was invented before the web and has a diversity of uses, which makes the books thicker and the setup more complicated and lowers the odds that any given web page about Python has anything to say about the problem you are trying to solve. Ruby is all about OO programming, which is great after you know what the hell OO is and how you should be using it. Before that, you'll either write Ruby that looks like bad PHP or you'll cut and paste idioms from Rails books without understanding them.

I wish I knew how to get more people using better languages. And I fear that I do know: They need good teachers. But, in the absence of a lot of great hackers who are primarily interested in teaching, and assuming that you aren't one of those rare people who can just pick up SICP and instantly feel a rapport with the authors [1], your best bet is to just get started. So if Python doesn't grab you, try PHP.

---

[1] I wish I had known to start with SICP; I think it would have worked out great. But I'm the guy who got so bored with BASIC and assembly that I taught myself Pascal three years before I got my hands on a Pascal compiler. It occurs to me that I may not be typical.

Re:Ask HN: What's a good programming language to start with? by timwiseman on Thursday August 13, 2009 @08:38AM (#760607)
Excellent points. To echo many others, it depends on what you want.

If you like Python, you can be a easily be a professional Python programmer and learn other languages only to get a different perspective. You can make a career successfully with Python alone and it is as real (though perhaps less traditional) as any other language.

If on the other hand your goal is to learn programming in depth, I would first start with C to get a better feeling for how things work on a low level and I would then start moving on to representatives of different paradigms (a solidly oop language, a functional language, perhaps a domain specific language like SQL or two.)

If your goal is to get a job and be employable, I would learn VB.NET. It is in high demand(at least in the area I am in) and if you know it then learning C# (also in fairly high demand here) is practically effortless.

Re:Ask HN: What's a good programming language to start with? by balding_n_tired on Thursday August 13, 2009 @08:44AM (#760619)
Agreed on Python. The PythonWin gives you a handy interface and access to the Windows COM world. I don't suggest you stop with Python, but it's a fine place to start, as far as I can see.