2 Hello, Earth! Extend your hello world
This chapter covers
- Writing to the standard output
- Testing writing to the standard output
- Writing table-driven tests
- Using a hash table to hold key-value pairs
- Using flags to read command-line parameters
As developers, our main task is to write valid programs. These programs are executed on a computer, and they'll accept some inputs (e.g: keys pressed on a keyboard, a signal received from a microphone), and will produce outputs (e.g: emit a beep, send data over the network). The simplest program of all does nothing, and simply exits. That wouldn't be a very gratifying introduction to coding, would it? Instead, let's have a hearty welcoming message!
Since 1972, learning programmers discover their new language through variations of the same sentence: Hello world. A programmer's first autonomous step is, thus, usually to change this standard message, and see what happens when the greeting message slightly changes. Type, compile, run, smile. This is what developing a Hello world is about.