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:

Those are JavaScript, C++, Swift, Java, and assembly language programs respectively. They are fairly complete programs with things that you will not understand. If this were a Swift programming book, I would go into detail about how Swift programs can be run in a “playground” using the Xcode development tool on a Mac. But this is not a Swift programming book, it’s an any-language programming book. So what is the same between all of the languages? They all contain instructions that cause the words “hello world” to show up on the screen somewhere. The “Hello World” chapter of a programming book is interesting but these pieces of source code (a term for the program instructions) don’t tell us how to program; They just show us one meaningful line of code as a test to see if we are able to build and run our program.

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!

For now, the few examples of code that we will run on your computer will be written in JavaScript. That’s the language for the code in that HTML file that shows up between the start and end of the <Script> element. It might also be a good time to mention that the data in that file that doesn’t look like alert( “Hello World”); is not Javascript, it is called HTML and is not a programming language. HTML stands for HyperText Markup Language and there are no instructions that are carried out when the file is opened. The HTML data just separates the file into sections of information that are used for different purposes. Some of those sections might tell the browser what title to show at the top of the browser window and some sections might tell the browser what text to display on the page, what font to use, etc., and even though these seem like instructions, they can also be thought of as labels that describe the look of things and their purpose. There is no way for the HTML to alter the data or to repeat something a number of times.

JavaScript

JavaScript is a programming language. It is a fairly weak language that lets programmers make lots of mistakes. But it is very easy to run your program because all you need to do is open that HTML file in your browser. No other tools are needed! JavaScript is not too much like the Java language so just think of it as being separate and unrelated to Java for now. The word “Script” does have some meaning that is hard to describe, but I’ll try; A Script is usually a program that is run without being translated in any way before you run it. If you change the HTML file to have different script instructions around the “Hello World” code, you can simply refresh the HTML page in the browser and that new software will run and you will see the results. Many other languages are not called “Script” languages because they are converted, sometimes a lot and sometimes just a little, to some unreadable data that is then run – the original text that we typed in as our program is not needed. And now you are asking the obvious question; Why are these different and why do I care? You don’t much care at this point because you are not going to worry about making mistakes and finding them as quickly as possible. Try this as an experiment; edit the helloworld.html file that is stored locally on your computer and change the word “alert” to the word “skdjfgk” or anything seemingly meaningless. Now refresh that browser page where you had opened the helloworld.html file. Nothing happens because your program has an error and the browser has no way to tell you about it. Well, no easy way to tell you about it. So you see no message about the error and no popup box because “alert” is the name of the instruction to show that popup box. programs that rely on conversion to some other form can tell us about errors at the time of that conversion. JavaScript has no conversion so there is no way to find out about the error until it makes our program malfunction.

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.