Hello World – The Most Important Program, Ever.

Over my career, I’ve written hundreds of software programs – some that took many months to finish, and some that only took a few minutes. One of my favorites that I’ve recreated dozens of times over the years is Hello, World!

Granted, the program doesn’t do a whole lot. It usually just spits out some text to a screen or terminal. In the microcontroller or FPGA space, it probably just blinks an LED on and off. Not exactly mind-blowing stuff.

My very first program was a grand total of 2 lines:

10 Print “Hello, World!”
20 Goto 10

…but it was magic (in it’s own minimalist way) and set the stage for many more exciting forays into the world of getting a microprocessor to do my bidding.

So why is a first step like this still so important? Simply stated, it narrows down the list of things that could be wrong to the smallest possible subset.

  1. It validates that your tool chain is installed correctly and operational.
    Depending on the environment and target platform, this can be a non-trivial task.
  2. It means you know enough about the language and environment to get it to actually build a working app. Again, in some environments this is simple. However, the closer to the hardware you are, the more work and configuration this tends to require. You did RTFM, right?
  3. It means that your target hardware is operational.
    This tends to be more of a factor with smaller,cheaper platforms – such as microcontroller development boards purchased off of eBay. I’ve had several over the years that were DOA or would not flash at all. For this reason, I tend to purchase at least 2 of everything – even when just evaluating a new board.
  4. It means the delivery/flashing mechanism works correctly.
    This includes connecting cables (i.e. USB) I’ve got several of these marked as “Power Only” – meaning that they can be used for powering a peripheral, but do not work reliably for device communication or flashing.

If Hello, world doesn’t work, I troubleshoot each item in this list until I have a working app. Even simple things can trip you up in unfamiliar setups.

Every time I get a new board, try a new development environment, or start with a new language (and there have been a LOT of these), step #1 is always to get a working Hello, World/Blink application. Always. The successful run is traditionally concluded by a loud “Woohoo!” whenever socially-acceptable. After all, you have to celebrate life’s little milestones….

I’ve also found that documenting the steps to get to that initial success stage can be very helpful. It may seem silly, especially if you’re mostly following steps from a webpage or book. However, webpages don’t stick around forever, and books get lost or forgotten. Having your own centralized notebook means that you’ll have the info you need when the time comes to setup a new VM/system, or your current one goes sideways. Murphy tends to ignore people who are prepared for inconvenient situations.

Finally, whenever I’m presenting a workshop, the very first exercise is Hello World/Blink. This makes sure everyone is set up correctly and ready to proceed. It’s easy for people who have been working in an environment for a long time to take a functioning environment and basic actions for granted. For someone new to an environment, NOTHING is obvious – even simple stuff. There is always at least one person who has an issue, and the simpler the program, the easier it is to troubleshoot the problem.

As they say, “Well-begun is half done.” So raise a toast to the humble Hello, World program – the gateway to the interesting projects of the future.