Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Rethinking Programming Language Tutorials (dadgum.com)
25 points by indy on April 3, 2010 | hide | past | favorite | 13 comments


> "After all, the reason to learn a programming language is to do something useful with it, not simply to know the language."

Probably not for people who create languages and that's one reason why programming language tutorials are what they are. They assume knowledge of some language and just go ahead with that.

Isn't that a good thing? Once you learn programming, you're really interested in learning a specific language and can discover the rest yourself. Should every language tutorial begin with a programming tutorial? I think it's a good thing they're not the same.

PS. One of the best language tutorials I've seen is: http://ooc-lang.org/ - assumes basic knowledge of other languages, in a couple of pages describes most of the stuff a programmer would be interested in. And it reads like a book, not a specification.


I completely agree. For example, he gives the example of an "associative array" as a concept that shouldn't be used to explain what a Lua table is, but really, for anyone with a moderate amount of programming experience, this is probably the most concise way of describing it.

It really depends on the audience. Someone who knows absolutely nothing will want a considerably different type of tutorial than someone who is already fluent in several languages. The latter just needs to be presented with a mapping between the given language and a language they are familiar with, and the "table" -> "associative array" analogy is pretty excellent from that standpoint.


A good example for a language tutorial with audience considered and selected is the official python tutorial. If you are firm in some other object oriented language, this tutorial can teach you almost the entire working set of python in a day, at most. However, if you have no clue about programming, understanding this tutorial will be extremely confusing and time consuming to the point of being pointless.

I have to say, I like this very much. I could just walk through this tutorial and associate existing concepts with pythons implementations of these concepts and just use it. Other language tutorials tend to annoy me by changing the level quite a lot or being way too low level.


Indeed. I think Python calling them "dictionaries" is pretty weird, but saying, "see, it's like a dictionary, you look up the key word and it has an associated value" is probably the right level of abstraction for someone new to programming.


Here are some Haskell tutorials that do introduce the language by walking you through an actual interesting problem:

Use simulated annealing to solve a computational geometry problem: "The final program will have less than 100 lines of Haskell and will organize a mass picnic in an arbitrarily-shaped public park map and will print pretty pictures showing where everyone should sit!" http://www.lisperati.com/haskell/

"Write Yourself a Scheme in 48 Hours" (implementing a simple parser and interpreter): http://jonathan.tang.name/files/scheme_in_48/tutorial/overvi...

Most chapters of Real World Haskell also take this form. For example, it walks you through writing a parsing library, and a barcode scanning program: http://book.realworldhaskell.org/


Just to add to the programming tutorials list, here's one for (/from) the Haiku project / C++: http://www.haiku-os.org/tags/tutorials - a series of blog posts.


Thanks, it pleases me so much to browse through these. The first desktop apps I wrote were on BeOS[1], and it's still the best-designed GUI toolkit (and probably the cleanest and most usable C++ API) that I've seen. Kudos to the Haiku project for keeping the flame alive.

[1]: http://www.advogato.org/person/mbrubeck/diary/101.html


I'm not sure that "Write Yourself a Scheme in 48 Hours" is the greatest example of a language tutorial that isn't steeped in programming-language-theory-geekery-for-its-own-sake. :)


"Programming language tutorials shouldn't be about leaning languages. They should be about something interesting, and you learn the language in the process."

-- I'd say this is the approach Michael Hartl has taken with Railstutorial.org. Learning the language is important, but it seems to me that, having been through this tutorial and his previous "RailsSpace," the most important stuff I've learned is how a programmer thinks. Programming language tutorials shouldn't be about leaning languages. They should be about something interesting, and you learn the language in the process. Re-Factoring. Test Driven Development. Version control.

Needless to say, if you know anyone with zero programming experience who wants to get up to speed quickly on web development, so he or she will know what you're talking about, what's possible, and what's not, I highly recommend Hartl's work.

-- Fred


In defense of the excellent but not-beginner-optimized Programming in Lua, its back cover describes it as "targeted at people with some programming background".


I also want to defend Programming in Lua, which is probably the best single book devoted to a programming language that I've ever read (only K&R comes close). I'm not alone in thinking highly of it--on Amazon, of the 30 reviews, 25 give it 5 stars and 4 give it 4 stars. The book is not really for beginners, as you can tell by the fact 30 percent or so is devoted to the C-Lua API, but since when should every book on programming be targeted to beginners? The book covers many interesting programming methodologies while giving a complete and thorough tour of the language.

In fact, though, Lua is a sufficiently simple language that programming novices generally have no problem learning it, and the first third or so of PIL should get the beginner on his way very nicely.


I think the confusion may come from Lua the language being designed for / promoted as scaling downward to a simple scripting or data-description language. You can learn it in several passes, doing useful stuff with it without advanced stuff (coroutines, metatables, tail calls, the C API, etc.) getting in the way of the basics.

_The Awk Programming Language_ is another slim and lucid language book. I don't use awk for much beyond one-liners (usually at that point I switch to Lua), but it has some real gems.


I wonder if a modern, practical programming language could be taught through a game where you "level up" on the basis of language knowledge.

Maybe something like a game which teaches concepts like Message Passing and concurrency using an Erlang like syntax or Metaprogramming through Clojure




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

Search: