Many programming books start out with a chapter called “Hello World” or at least a section of the chapter where the programming itself is being taught. After installing text editors, compilers, etc., a program must be written that does something visible, and so, the “hello world” program is written. Here’s what that looks like in a variety of languages:
Building and Running Our Program
Now that the “Hello World” stuff is out of the way, it’s time to start learning about writing software. For anyone reading this that has no understanding of these things, software is “soft” because it can change without any physical changes being made to the hardware of a computer. There are atomic and electrical changes happening inside of the computer constantly, and those things are physical, but no one is opening the case of my computer and plugging in a new part when I write and run a program.
So far, we have established that software is a set of instructions. What was not mentioned in that first chapter, when the instructions said to use a list of names, was the fact that the list of names is also part of the program. The instructions in a computer program reference information that is stored somewhere in the computer memory. This data can be moved around, stored on a persistent storage device, and altered when needed. We now have a foundation for writing software: Instructions and data. Now things will get complicated.
Let’s see if you can run a program on your computer or device right now. Click on this link: helloworld.html and see if you get a new browser window or tab and then a popup message that says “hello world”. You can close that tab or window now. If you are not using a mobile device, you can easily save the contents of that file locally by just right-clicking on it and selecting “Save…”. The exact text of the popup menu might be different using different browsers and on Chrome, the option is called “Save link as…” and the name and location for me was my documents folder (on Windows 10). If you can figure out how to save the file then you can find the file on your computer and double-click it to open it. Windows 10 asked me to pick a program to open it and I selected Chrome since that is my current browser of choice. When Chrome opened the file, I saw the same popup box with the words “hello world”. You are free to open the helloworld.html file and change the text to something else. Go back to your browser and refresh the page and you will get a popup message with the new text. You have now modified the software to do your bidding!
You learned so far that computer programs are instructions. You learned that they have some data in them that can be used by the instructions, like the words “hello world”. You also learned that some programming languages get converted to some other format and some, usually called scripts, are not converted. You learned that if we make mistakes in our software, that they are not always easy to discover. Next will be a lesson about the nature of the data and how the instructions in a program can use it.