Hacker News new | ask | show | jobs
by kylec 4128 days ago

    You take an incredibly advanced and complex programming language,
    and dumb it down to the absolute bare essentials in order to embark
    on the journey of learning a new system.
The purpose of the "Hello, World!" program, at least as I've understood it, is to make sure that you can actually get code running with whatever language, frameworks, and build process you have. Printing out a simple phrase is sufficient to demonstrate that that all works and that you can start making more complicated things.
4 comments

It's likely that you already know how Hello World works in at least one other language. By showing you it in the new language, Hello World allows you to start mapping concepts across those domains (ie, how to print characters to the console, where the entry point is, how to express string literals, etc).
"The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages: Print the words hello, world" - p5, The C Programming Language, Kernighan & Ritchie, 1978.
If we're talking about the modern purpose of a "Hello, world!" program, then I agree. However, at the time the idea was originated, and I'm sure for a good time afterwards, build processes and frameworks weren't as mainstream as they are today. Therefore the function of a "Hello, world!" program was simply to test out the basic features of the language. That's the way I see it.
The idea of the “hello world” program was promulgated by Kernighan and Ritchie in “The C Programming Language”, and they saw it the way kylec does. Quoting “The C Programming Language, Second Edition”:

“This is the big hurdle; to leap over it you have to be able to create the program text somewhere, compile it successfully, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy.”

(I got rid of my first edition years ago but as I recall it described the purpose of the program pretty much the same way.)

Thanks for the reference.
It doesn't take modern build processes and frameworks to need to know that you've crafted the bare essentials for a running problem, and the multi-stage compilations and linking process has performed as expected. Or that your cross-compile is working. Building software has been complex enough to warrant this for many decades.
Is it though ? I always had a little voice in my head thinking this is just `a posteriori` justification.