The "Kitchen"
A development environment includes the tools and processes we need to write the code, "translate" or compile the code, then run the program.
- We'll write the code in a text editor and save it in a .c file.
- In the terminal window, we'll use gcc to compile the code, transforming it from the C programming language to 1s and 0s.
- If compiling works, we can run the program by starting the resulting executable in the terminal window.
(If you've heard of an "IDE", that stands for Integrated Development Environment which is just software that integrates, or combines, these all together tools altogether.)
We'll also have to consider how to submit our code for the programming assignments.
Operating Systems
Since operating systems are considered the brains of the operation, we should consider them first.
An operating systems (OS) is a program which manage all of the tasks and hardware that make devices work. Chances are, your computer is running either a Windows or MacOS operating system. Usually development teams decide together which OS to use, but we can't ask half the class to get new computers! As a compromise, we'll use a platform that many programmers use called Linux.
Linux is "open source", which means we don't have to pay for it (and you could even modify the source code for yourself, if you wanted to!). The challenge is that a computer can't have two operating systems running at the same time. There are many solutions to this problem, but this class will use either of these approaches:
- virtual machine
- remote hosting
We'll let you know which one to use this semester.
Linux Terminal Window
No matter how we access our Linux environment, you'll need to learn some new Basic Linux Commands so you can navigate the terminal window or command line interface (CLI). We'll be using the phrases "terminal", "terminal window", and "command line" interchangeable since they all mean the same thing.
Every OS allows you to type commands into a text window to tell the operating system what to do instead of clicking on icons (GUI). We'll be using the Linux command line primarily to "navigate" to the proper folder so we can execute commands to compile and run our code. And since we'll all be using the same program and commands, it will be much easier for staff to help students troubleshoot any issues!
Writing the Code
Writing code happens in a good, old-fashioned text editor. A text editor is a program used to create and modify files, like Notepad on Windows or TextEdit on MacOS. When we're in our Linux environment, we'll use a text editor called "Gedit" to create the file with a .c extension which will contain our C program.
Compiling the Code
"Compiling" is the process of transforming the C code in our .c files into the 1s and 0s a computer understands. The .c file which contains our code gets pushed through a program called a "compiler", which we "invoke" or run from the command line. The compiler will check our code for syntax errors, which are kind of like punctuation or grammar mistakes. It it finds errors, it will display them on the command line. The errors messages contain the line number of the mistake, but the messages can seem kind cryptic at first. If your code doesn't have any syntax errors, the compiler will create a new file, called a binary or executable and we will do a little dance. The new executable the compiler creates is the actual program that we'll run.
Running the Program
If we've used our simple compiler command and there are no syntax errors, the resulting executable should be in the same folder as the original .c program file is in so we won't have to change directories or navigate to a different folder to run our program.
The programs we build will also be run on the command line. These programs will look pretty, often displaying some text to the screen and accepting what we type into the terminal window. Even though they may seem simple, it's important that we test our program's behavior to verify it works the way we want it to.
Debugging
The code we write is almost never works perfectly the first time. We may have to correct our syntax if there are compiler errors. We may have to rearrange our code if the program doesn't do what we want it to. This process of writing code, fixing syntax errors, and correcting program behavior is called "debugging". It's a big chunk of The Development Process even though it's not always the most fun part. And while it's very normal to make mistakes, we also want to learn from them as we go so we can be prepared for writing code by hand on the exams (and interviews!).
Submitting the Code
We'll be using a platform called GitHub Classroom for submitting our programming assignments, which is based off a popular developer tool called git (pronounced like get but with an i). You'll need to run through the git Setup process once at the beginning of the semester to be able to use it. Be sure your username follows the correct format!
From each WebCampus programming assignment, students will click on a GitHub Classroom assignment link. This tells GitHub Classroom to create a "repository" (folder) for that student in the cloud. A "remote repository" created for every student and staff also have access to them. Once it's created, the student will have to "clone" the remote repository which makes a local copy of the folder in their environment. After the "local repository" is cloned, the student should navigate (change directories in the terminal window) to the new local repository folder. The new .c file for your program code should be saved to this local repository folder.
Once you're done writing and debugging your program, it's time to follow the GitHub Submission process to upload your file to the remote repository so staff can review it for grading. You can verify the process worked by refreshing the GitHub remote repository page in your web browser, where you should see your .c file. You can glance through some tips on Using the Autograder, but we're just using it to make sure your code compiles (not for grading)!
You can find more information about git, GitHub, and GitHub Classroom.