1. Install VMPlayer
    1. Go to LCDR Kenny's software page and download the file SI204-LiveCD.iso linked on that page. (LiveCDs, SI204).
    2. Follow the directions there to download VMPlayer and and to set up VMPlayer on your Windows Laptop (see Note 2). These directions will create a Virtual Machine (VM) image on your computer from the .iso file. This VM image will live on your Windows laptop, and you will be able to run it whenever you need a Unix machine to work on.
    3. Important: A few tips for using your VM:
      • ctrl-alt-esc gets you back your cursor if its "stuck" in the VM
      • ctrl-alt-enter toggles back and forth between fullscreen mode

Note: For this assignment only, there is nothing to turn in. However, you will need to bring your laptop to class Wednesday to demonstrate that the VM is working (and learn a few things about it too).

What is this course about?

This course is an introduction to programming. Programming is a creative, constructive process. Just like you have to understand the rules of grammar and vocabulary before you can engage in creative writing, you have to understand the rules of programming before you can solve problems with it. In this course, you'll learn the rules and techniques of programming, while applying what you know in a more and more creative way. We'll use the language C++ (we'll also see some C), though most of what you'll learn is applicable with small changes to many of the computer languages you're likely to encounter.

Compiled vs interpreted, and why C++ is different than Javascript

You should review the computer architecture section of SI110. Here's a link to last year's site.

The question of "What is a computer program" is actually kind of a tricky thing. Computer chips require that their instructions be given with extremely fine-grained specificity. If you take a computer architecture class, you'll learn about how to program for the chip itself - you will learn a lot, you'll understand far more about how computers work, and you'll walk away understanding that if you had to take your big ideas, and translate them into that fine-grained of instructions, you'd never get anything done. We call this "low-level" programming, because you're down close to the chip, speaking its language directly.

It used to be this was the only way to program, until 1952, when RDML Grace Hopper (who was awesome) invented the compiler, allowing for higher-level languages. In a compiled language, programmers can spend their time focusing on the program flow and logic, and less time on individual, specific instructions about what registers hold what data and whatnot. When they're done, they run the compiler, which reads the text of the program, and translates it into the far more specific low-level language, creating a new file in the target language. This new file can then be run on the chip.

Since then, an alternative to compiled languages has been introduced, called interpreted languages. Interpreters fill the same role as compilers, but the translation occurs while the program is running, rather than in advance.

In SI110 all of you got exposed to Javascript programs. Javascript programs are executed by an interpreter in the browser, whereas C++ programs are compiled, and the resulting executable is then actually executed by the physical machine. That fundamental fact leads to some of the differences you'll observe. Others come from the fact that JavaScript wishes to be very high-level. This makes it a good choice for doing interesting things with two lectures' worth of preparation (as in SI110), but a poor choice for spending a full semester on programming. The stricter rules of C++ force you to understand the computer much better than you would in an extremely high-level language like JavaScript.

Below we walk through the steps involved in turning C++ code into an executable program.

Use an editor to create the file hello.cpp containing the source code for the program. Use a compiler (g++ in this case) to translate the human-readable C++ source code into machine-readable object code hello.o. Use a linker (g++ does this as well) to combine our object file hello.o with other object files (like those that take care of input/output) to create the executable program hello. Use the OS to initiate execution of (i.e. start te fetch-decode-execute cycle on) the program hello.


At the end of the notes for almost every lecture will be a couple of example problems with solutions. Everyone likes to see examples of code, so that's what we give you!