CS 257: Software Design

Setting up your development environment

Nothing to hand in

You'll need to work on your own for this, since it involves setting up your own computer. But absolutely take advantage of our class Slack workspace to ask questions if you get stuck.

Goals

Summary of your tasks

Here's the quick summary of your tasks. Much more detailed instructions are in the numbered sections below.

1. Get ready to use Slack

Communication for this class is going to take multiple forms:

Slack is a chat tool that has become extremely widely used in businesses and other organizations. Carleton CS majors started using it for comps team communication about five years ago, and we've gradually increased our use of it in classes since then. The CS faculty and staff have a very active Slack workspace. I would have been lost without this easy access to my colleagues while preparing to teach online last term.

Here are your Slack-related tasks for this assignment.

2. Set up a Unix command-line interface on your work computer

Unix is a family of operating systems whose shared heritage goes back to a project begun in 1969 by Ken Thompson and Dennis Ritchie. Linux is a Unix-based system. macOS is a Unix-based system. Holy cow, are there a whole lotta Unix-based systems.

There are three reasons I want you to have access to a Unix command-line interface on your working computer:

2.1 If you're working in the CS labs on 3rd Olin

Boot up macOS and you're good to go. Mike Tie has installed all the Unix tools you'll need. Masks and distancing required, of course.

2.2 Getting a Unix command-line interface

This depends on your computer's operating system.

For macOS, the Terminal app (installed on all macOS systems in /Applications/Utilities) gives you a Unix command line. Apple's variant of Unix is a descendant of Berkeley Unix from the early 80s, with occasional small Apple-specific adjustments.

Linux systems all have at least one terminal app, with various names, depending on which Linux distribution you're running. In my experience, a terminal app is easily available via the desktop or default menus on Linux distributions.

On Windows 10, you don't get a Unix terminal by default. Instead, you'll need to install the Windows Subsystem for Linux (WSL), which will give you a Unix terminal app. To do the installation, follow these WSL installation instructions, with the following clarifications:

This is a lot more work for Windows users than for macOS or Linux users, but that just means you get to learn more than they do.

2.3 Make sure you have vi/vim, python3, and git

Open your Unix terminal app. Type the following command. (NOTE: you always hit Enter at the end of a command to execute it.)

which vi

The answer you will get will almost assuredly be:

/usr/bin/vi

The "which" command is saying that the "vi" command in your system is located at the path /usr/bin/vi.

Do it again for two more commands:

which python3 which git

If you get nothing after either of those, you'll need to install the missing command with a package manager. Which brings us to...

2.4 Install a package manager

Package managers make it (relatively) easy to install, update, and uninstall software. That will be very handy as we add new tools to our toolkits later in the term.

On Windows 10, once you have installed WSL, you should have the command "apt" installed. You can run "which apt" in your Unix terminal to make sure. If you don't have "apt", then you surely have "apt-get".

On Linux, same thing as on Windows—apt or apt-get.

On macOS, I strongly recommend that you use the Homebrew package manager. Go to that link and follow the brief installation instructions at the top of the page.

As an example, let's install the package "imagemagick", which is a collection of tools that help you manipulate image files. I picked this example because it's an interesting tool and also not installed by default on any operating system I know of. Here are the commands that you could use to do the installation:

brew install imagemagick (on macOS) sudo apt install imagemagick (on WSL or Linux)

Note that "sudo" (from "super-user do") allows you to execute commands with the Unix version of "administrator privileges". Sometimes, you can try to execute a command and you'll be told you don't have permission to do so. For example, when I try "apt install imagemagick" on my WSL terminal, I get told "Could not open lock file" and "Permission denied", which is a slightly perplexing way to say "only administrators are allowed to do that". But if I do "sudo apt install imagemagick", everything works fine.

Once you have imagemagick installed, you can try any of its zillions of options. For example, suppose I want to take a JPG file of my dog (maisie.jpg) and scale it to half width and half height (thus cutting the file size by approximately a factor of 4), and also convert it to PNG format. This command will do the job:

magick convert -scale 50% maisie.jpg maisie.png

2.5 Install python3 and git, if necessary

Remember executing the commands "which python3" and "which git"? If either one of those "which" commands returned nothing—that is, the command in question isn't available on your system—then it's time to install whichever command is missing.

On macOS, that would be "brew install git" and/or "brew install python3".

On Linux or WSL, "sudo apt install git" and/or "sudo apt install python3".

3. Get ready to use git and GitHub

One of the most important tools in a programmer's toolkit is version control software. Version control gives you a convenient way to: back up your documents (code, documentation, data, images, etc.); track document changes over time; roll back a document to an earlier version; share the editing of documents with your collaborators; etc. Version control systems are powerful, complicated, and indispensible for both individual programmers and teams.

This term, we will use the version control system git. We will also use GitHub, a website and company that provide hosting and other services for people using git. The central copies of your work will live on GitHub, and you will transfer the changes that you and your collaborators make to your code and other documents back and forth between your individual machines and GitHub via git commands.

To do this, you will need a GitHub account. So:

No need to do anything further with your GitHub account for this exercise. We'll start using it for your next lab.

All done

That's all for now. You have a Unix terminal on your computer, including python3 and git, and you have a git repository ready on GitHub. Next up: we'll start learning how to use all this stuff.