Hacker News new | ask | show | jobs
by alextgordon 5675 days ago
This article is misguided.

Hello World serves two (and only two!) purposes:

    1. It's traditional
    2. It lets you check everything is working
It isn't a way to evaluate or compare languages. How could it be? It only uses a very small fraction of the language. Note that the Hello World for C is rather long and inelegant. But C itself is definitely an elegant language. So its predictive power is poor.

QuickSort is neither traditional nor something a beginning programmer could use to check everything is working. Therefore it is not a substitute for Hello World.

- - -

If you want to get a feel for a language with one code snippet, allow me to introduce the Trabb-Pardo Knuth algorithm:

    In their 1977 work "The Early Development of Programming Languages",
    Trabb Pardo and Knuth introduced a trivial program which involved
    arrays, indexing, mathematical functions, subroutines, I/O,
    conditionals and iteration. They then wrote implementations of the
    algorithm in several early programming languages to show how such
    concepts were expressed.
http://en.wikipedia.org/wiki/Trabb_Pardo%E2%80%93Knuth_algor...

    ask for 11 numbers to be read into a sequence S
    reverse sequence S
    for each item in sequence S
        do an operation
        if result overflows
            alert user
        else
            print result