Goodbye, Cruel Hello World

March 18th 23:35
by why

What makes a good Hello World program? Because Hello World itself is a terrible Hello World.

You have to find something that:

  • Is brief, like a single line.
  • Functions in a sensory fashion.
  • Perhaps even plays to a language’s strength.

Case in point: what if your language is no good at showing text?

A crisp, clear piano, rambling on for decades.

Luke DuBois has a Hello World for Max/MSP that reads like the above. He starts simple, with just the checkbox, the sample, a random 128 and a noteout. It’s a nice grand piano, putting down notes willy-nilly. And he gradually gets the duration and intervals of the notes randomized with a few more words.

Once it’s going, he clicks off to the side and types out: random atonal crap. And says aloud, “Or this is how you win the Pulitzer Prize for Music, circa 1973.”

That’s a bona fide Hello World.


Hello World in a terminal is a certain kind of deadness. Terminals are useful but musty things. It’s a mute, fixed-width hello. (And, I mean, where do you take the program from there? Sure, fill up the window with Hello World, great.)

You may resist this by saying that Hello World is just a sanity test, nothing more.

Hey now, it’s the first program a beginner runs. It’s the hook at the start of a novel, the first scene of a movie, the initial chords. You don’t get psyched by a mic check. You at least want to see the fog machine going.

They don’t countdown from 5 to 1 with a color clock at the start of a movie any more. Sanity tests are outmoded. We’re all sane here. Or past sanity, we’re on to the next thing.


Okay, here’s a rough approximation of Luke’s demo, while we wait for the real videos to be released. Me, an hour into goofing with Max/MSP.


Hello World, the Song (in Max/MSP)
from why the lucky stiff on Vimeo.

I took a poll in the Drawing Cats with Hackety Hack class: what’s your ideal Hello World? Before I let on what their responses were, tell me your thoughts.

What’s your ideal first program for an utter neophyte?

Now begin the comments …

21 comments

bona fide neophyte

said on March 18th 19:33

First, sort of long time reader but first time commenter.

That demonstration of Max/Msp is really intriguing. I have had my share of “hello world” experiences and none of them have caught my eye like that one. I actually consider all first time programs to be small and sort of boring that inevitably leave me wondering why I’m even bothering. I suppose the word that usually best describes it is “bummer”. Like, whats good is this going to do for me cause I don’t know how people go from this to anything useful and so I inevitably end up in a world completely different than where I started.

So my ideal first program is one that shows it like it is and gives me some glimmer of hope for where I could be. Maybe that doesn’t make sense but that demonstration I thought was amazing. I’d very much like to learn more about that and that’s not how I often feel after a “hello world” experience.

IdeaHamster

said on March 18th 22:36

My ideal “Hello, world”?

FIREWORKS !

No, seriously… That’s the very thing that got me into programming. One I realized that I could draw blocks of color in Apple //e basic, I set forward learning how to randomize the clustering and the color and reset the screen…and I had a fireworks screen saver!

Alisey

said on March 19th 01:49

My sister enjoyed this one: Checkers
And this one: Rainbow

She just sit there watching me messing with numbers and telling what to do next. We had all kinds of checkers, and rainbows, and rainbow-colored checkers.

Dave

said on March 19th 05:07

I think you’re either being too hard on traditional Hello World!s or you (we) are missing a word or meme to describe the type of small yet intriguing program that gets you thinking “Hey, I could do something with this!”.

Hello Worlds lets you know everything is working after a, usually unnecessarily uncomfortable, install. It gives output, the obvious next step being input that is echoed, then input that is processed in some way.

What is needed then is not one, but many, examples across multiple domains. I mean does MAX / MSP do images? video? I don’t know from the above.

hgs

said on March 19th 05:52

Terminals? But there are things like banner(1), and ANSI color (which got lost in the transition from DOS to Windows, it seems — CMD doesn’t have it), and [n]curses for moving ASCII graphics. This is more about how expressive languages are: like ruby having each, which is what you mostly want when you write C’s for loops.

Then there’s:
http://arstechnica.com/gaming/news/2007/06/german-programmer-programs-hello-world-into-wheat-field.ars

MattKatz

said on March 19th 07:40

The first program should be so simple that it requires no debugging. There should be nothing to mistype.
Once you know you’ve got the thing doing something, you can build… Echoing a string doesn’t do much to excite, but it gets you moving and building. And it’s very hard to mistype.

akahn

said on March 19th 08:23

This stuff is so ill, I hope you keep posting about this stuff.

_why

said on March 19th 10:18

MattKatz: Of course, you are right. However, scroll down over this list and tell me honestly how many Hello Worlds would really pass your test.

I’m asking for something that’s both easy to type and more interesting than printing a string. Surely computers are capable of more?

Dark Sekret

said on March 19th 12:54

My fist ever program was printing “Hello World” in a loop in C64 basic. I spent a few hours wondering why basic gave me a syntax error when I typed the line number as 1-oh-oh-oh v.s. 1-zero-zero-zero!!! Duh!

After that the next program printed randomly coloured lines to the screen, scrolling up the terminal.

Bluebie

said on March 19th 17:01

Whenever I start using a new language or toolkit, I do it motivated by an idea I want to build, so the best hello world is always the simplest first step towards that idea. This means something as powerful as hackety hack would need multiple hello worlds to really satisfy people like me.

Still, I think the best sort of first ever program demos for kids and perhaps adults alike are ones which are interactive. If we’re talking shoes, I’d recommend the mirrored dot. Where you create a black circle on a white background, and then move the dot on mouse move events to be at [window.width – mouse.x, window.height – mouse.y], creating a nifty, uncommonly seen effect, without much complex code or maths. It’s a bit longer than print “Hello World” though.

failrate

said on March 19th 18:46

The first thing I like to do with any new development platform or programming language is to get a little sprite that I can move around with the cursor keys. The feeling of engagement when I can control my tiny on-screen character is satisfying enough to carry me through a great deal of subsequent frustration. This has been the case from my first programs on the TRS -80 to 3D code on modern hardware.

cisco

said on March 19th 19:14

My first dabblings into whichever puzzling programming system in front of me usually consist of the ever useful palindrome checker and secondly usually some thingamagic to check if a certain number is a prime number. (Adding #prime? to Numeric being pretty magical, though without doubt I’d be hard pressed to describe my excitement about that to my mother).

Two questions: What timeframe are we looking at? After the couple of hours that you describe you worked your way into Max/ MSP , most other people are well past Hello World as well. And what audience are we talking about? What’s exciting to me is boring to other people.

But, since you asked: What got me fired up about programming (and therefore my picks for the title of Neato Hello World) were
1) An article about the iterative prisoners dilemma, where contestants could send in programs to supply certain game strategies. This could probably be used in a tutorial to move from simple strategies (Tit-for-tat) to more complex ones.
2) The ubiquitous little programmable virtual ‘bot that could navigate an ( ASCII -don’t-hate-the-terminal-) maze and pick up objects along the way. The first example was always to add a subroutine to have three “turn left” commands provide a “turn right” command.

mdaines

said on March 20th 08:20

I second the little sprite and the arrow keys, or something like it. Being able to make a little thing that responds to input the way you expect has always felt rewarding to me.

I recall a book for learning C on the Mac that showed a bunch of incantations for drawing stuff, doing calculations, etc. but was really thin on ways to interact with the computer.

failrate

said on March 20th 15:44

One thing occurred to me: Hello World programs are often nothing more than introductions to minimum syntax. That’s why hello_world.c is like #include int main() { printf(“hello, world\n”); }, and hello_world.rb is simply puts “hello, world”

If the minimum syntax for a program is 0, then it seems like we almost completely skip past it to like “hello, universe” territory or something.

advee

said on March 20th 22:41

I’d much rather see the computer say hello to me than the world. The cultural stickiness of hello world is actually sortof bizarre. Because when you’re first learning to program, you have to be taught that “hello world” is really the thing to do. Have you ever tried to explain to someone who doesn’t know the first thing about programming what the significance of “hello world” is? I have, and when I listened to myself explain it, I realized I made no sense.

But what if instead I had explained: “Well, type in your name!” and the computer said, “Hello, Susie!”? That doesn’t really need to be explained. That’s how humans meet and greet each other for the first time all the time anyway.

Graphics also don’t need to be explained. It seems like the most appealing thing to do—at least initially—with a computer is to make it do stuff. The first “programming” I remember doing wasn’t “hello world” but “forward 40” and watching the LOGO turtle move. Even better was changing its color!! It really doesn’t get much better than that.

As a side note, game designers know how cool it is to inscribe yourself on the computer world, especially in graphical form. Breaking blocks is cool. Even better is being able to shoot things. And destroying things in unique and interesting ways is the awesomest. Because of the whole tending-towards-chaos thing, it’s actually a lot easier to destroy stuff in games than create stuff. Maybe that will change as the technology gets more sophisticated. But now, the ability to destroy stuff in games is expected, so it might be too deeply ingrained.

But someone mentioned fireworks. Yeah! Explosions are always cool. How about: “Hello, Susie! [ EXPLOSION !!!]”

Matt Todd

said on March 24th 11:06

For me, as a deeply rooted web developer, something responding correctly to the HTTP stanzas would be a pretty cool little diddy to introduce me to the mindset of the language and libraries.

vidr

said on March 25th 03:37

“Hell-o world” in ruby-glfw?

zem

said on April 6th 06:17

advee, back in the microcomputer basic days, the ‘hello world’ example was indeed often

10 PRINT “What is your name?”
20 INPUT A$
30 PRINT "Hello ", A$

Nish Nosh

said on April 6th 23:18

I don’t think that Hello World is a good demonstration of a language, but I do think it is a decent example and test of the edit, compile, run loop (or REPL), which is what I always figured it was meant for.
From K&R:

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
This is a 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.

Patrick

said on April 7th 05:54

When I learn a new language, I always make a rotating wireframe cube.

I once told my friend who was learning postscript this, and the next day he came back with a home-made postit-deck-like thing which he flipped before my eyes to actually produce a rotating, wireframe cube. Completely insane.

Here’s the postscript source.
Note the matrix/vector stuff and 3d projections…

Kristleifur

said on April 20th 09:21

Patrick, I salute you.

Going to borrow your idea when I teach myself Curses programming.

said on Mon DD HH:MM

* do fancy stuff in your comment.

PREVIEW PANE