Lecture Notes 0: Welcome to CS1111
Objectives
By the end of this module, you will be able to:
- Identify the rules for the course.
- Identify all the tools and mechanisms that will be used in the course.
- Explain the difference between Programming and Computer Science.
First Steps
- Sign up to Ed (check your GWU email for an invitation).
- Fill out course survey available on Blackboard under the Assignments section there, and upload to Blackboard for grading.
- Download ical of due dates for the class [optional but recommended] from Ed.
The Syllabus (Course Information)
The class information is located in the Syllabus link of the navigation bar.
We will go over it now. When you are done checking it out, make sure to continue here.
The Most Important Point: This course is designed so that anyone can learn to program and do well even without any prior experience!
Using Ed and Blackboard, and virtual meetings
We will use Ed as our main communication hub.
Please join Ed (via invite emailed to you).
We will use Blackboard to submit graded assignments.
We will be posting links on Blackboard to submit homeworks and exercises. Let's find the
day 1 survey submission link together now on Blackboard.
Why do we (or should we) learn to program?
There are many answers here, let's chat about it!
The HelloWorld program
This is the classic basic example (the colors are just highlighting):
public class Hello {
public static void main(String[] args) {
// generate some simple output
System.out.println("Hello, World!");
}
}
This program is written in a programming language called Java. After it gets processed and executed by the computer, the result is that a phrase is printed in the Terminal (more on this later):
"Hello, World!"
Let's visualize this programming running together by copying it (already done for you) into the
Java Visualizer! Note: we will be using the Java Visualizer most of the semester.
The program-to-print process (in simplified form) looks like this:
What is in the Hello.java program?
The parts of this simple program:
We'll talk more about these parts and why they are organized like this in a later class.
For now, think of these parts as:
- Class: An Object or Entity (like a Pizzeria)
- Method: A Behavior or Service in that object or entity (like preparing a pepperonni pizza).
- Statement: An Action or Step inside a behavior or service (like adding pepperonni to the pie).
Class participation activity: [5 minutes]:
Modify the code in the
Java Visualizer to print out your favorite color (you can make this up). Then, run the visualization to make sure it prints
to the terminal. Finally, copy the link the Visualizer creates for a code snippet, and share this link with
the class on Ed under the thread titled "day 1 in-class exercises for Tuesday 1/11". Ask a neighbor if you need help with
any part of this exercise -- we want to make sure the whole class is able to use these tools! If both of you
still have questions, raise your hand in lecture and we'll be happy to help!
First Question: Why not just use English?
- The English language is rich but ambiguous!
- "I saw someone on the hill with a telescope."
- "Look at the dog with one eye."
- "Acceptable uniform colors are red, green, or blue."
- A computer can't know what you "really" meant if you try to specify it in English! So,
- it will do what you said, not what you meant
- this distinction may not be obvious to a human
Solution: Use an unambiguous form of the language, even if it is a little less expressive.
In this case, we will be using the
high-level programming language called
Java.
What is a High-Level Language?
A computer works like a flowchart, where information/data is what "flows" through the decisions.
A Low-Level language (like bytecode or machine-code) is composed of the set of instructions that
can be directly executed by the computer's central processing unit (CPU). It is "machine-speak" and it is
very distant from English. To the human, it looks like 0s and 1s. This is because on a computer, 0s and 1s
can be represented through electrical currents (either on or off), and gates can be used to control how
the current flows. No human wants to write in this language.
Solution: represent this low-level language in something easier for humans to deal with. Why? Because
someone needs to eventually be able to easily understand the code to debug it. Then, have software
translate the human-readable language into a low-level language that the machine can process.
These programming languages that are closer to English and that allow you to use abstract terms and
instructions are called High-Level Languages. Some of these are (C, C++, java, Python, etc).
The conversion of a program (written in a High-Level language) into an executable (written in machine code)
is called Compilation. Note: we'll assume this model for
this course, but there are actually some details we're leaving out right now for the sake of clarity for
those of us new to programming.
Class participation activity: [1 minute]:
Modify the code in the
Java Visualizer that we used earlier to try to "break" it by making the compiler unable to translate
the Java code into bytecode. We know that it is "safe" for us to change the message "Hello World!"
that gets printed, but see what happens when you touch other parts of this code. You should see an error
message if you successfully broke the code -- we'll see a lot of these during the semester, so don't
be afraid of them! We'll also learn how to interpret these error messages from the compiler.
Programming, Compilation, and Execution
How do we use the program so that the computer does what we want it to do?
- A Program is a set of instructions for building an executable (something that when run, tells the computer how to move information around).
- A Compiler is a program whose purpose is to convert these instructions into a file (bytecode) that can be executed by the computer.
- Executing a compiled program (the executable) means that the computer processor follows the sequences of instructions to complete a specified task.
Next class:
We'll see which files are involved in the writing, compiling, and execution of a program.
Learn the basic commands to use with a terminal.
Assignments for next lecture:
On the Schedule, read the "Lecture Notes 01" and be prepared to take a short quiz on Blackboard at the start of the next class (Thursday) on
that material.
Fill out the day 1 survey on Blackboard and submit it there by the due date