Hacker News new | ask | show | jobs
by bmitc 1490 days ago
Is there really a point to hello world programs? For most languages it consists of basically just typing out the string "hello world".
3 comments

It’s useful for testing that you have the langauge tool chain installed and working correctly.
While I do think it would be nice to compare using a program that is slightly less trivial, it's actually useful to see for how many languages the "Hello world" program requires a lot of extra ceremony. Look how verbose the Java program is for instance. I do think this says something about the priorities of the language designers.
In that spirit...for php, you could just have "hello world\n" in a file, since it's a template language by default.
That would not test PHP installed correctly at all, just the webserver unless you run it from the console. The whole point was to test that the language is working correctly.
I don't think you understand. Php would be processing the file. Try it with the php cli.

echo "Hello World" > file.php && php file.php

That's what I meant with "unless you run it from the console". But since the purpose with PHP is usually to run it on a webserver, you want to try that it actually works with the webserver.
Ah, okay. The context in which I was sharing that was about verboseness, "extra ceremony", and "priorities of the language designers". It meant something specific in that context.

Though you could still test that it's working in a webserver, since if it came from php rather than just the webserver, it would have some additional headers like X-Powered-By.

I think there's really only value as a first step for compiled languages so you can actually see a result.

For most languages you're right, the into is one concept.