Unit 1: Getting Started
Topics covered in this unit
After completing this unit:
- you will have seen the Course Policies for this class
- you will have installed the software needed for this course on your computer
- you will have identified the textbook for this course
- you will have downloaded the College Board's AP quick reference
- you will have completed the Student Info form
- you will have looked over instructions for Turning in Work and Working Efficiently
- know about the five hardware components that make up a computer
- know about file systems, windows, files and folders
- have learned what a Terminal is, and used it on your local machine to log in to a remote server
- have learned about computational thinking, and how to use it to analyze problems
Unit 1 - Introductions
- Introductions
- Hardware
- Software
- The Operating System: Desktop, Windows, Files, and Folders
- Computational Thinking
- Installing our Tools
- Encapsulation and Binary
1.0. Overview
In this Unit 1 introduction we'll introduce some fundamental computer concepts, discuss the idea of computation, and get things set up on your computer.
1.1. Introductions
Hi! I'm your instructor. You can learn a little about me if you look at the FAQs on our course website.
I don't know you yet, but I'm looking forward to getting to know you a little over the course of our time together in here. To help me get started on that, please fill out the Student Info form on our website. Thanks in advance!
1.1.1. The Course Website
Almost all of the course info is on the website, including:
- course policies
- course schedule (including assignments)
- link to our Course Text: Downey & Mayfield's Think Java: How to think like a computer scientist (2nd edition)
- link to the College Board's Java Quick Reference
- link to the AP Computer Science A - Course and Exam Description
- handouts for assignments, pseudocode, solutions
- course readings
- links to online quizzes
- links to other resources
The course schedule on the website lists what we're planning on covering each day in class, along with the assignments that you should be working on and turning in that evening. The assignments should be listed on MyPoly as well to help you in planning your work.
1.1.2. Course and Classroom Interactions
Some "classroom etiquette" for you.
- Be ready to take notes during classroom presentations.
You'll want to pay close attention in class when new material is presented. You may by working on the computer, or you may be taking notes on paper. - "Unitasking is a digital skill."
Don't be offended when I ask you to close your computer screens for a moment—that's just an easy way for me to make sure that you're not being distracted as I present important information. - Classroom interactions
I will sometimes "cold-call" students to ask what they think about something, or to analyze a situation, or to provide an answer to a question I've asked. Give the answer if you know it, take a guess if you don't, ask a clarifying questions before you reply, or just to say "I don't know." It's all good! - You'll be writing code almost every day,
and you need to be able to switch into that mode quickly, getting your machine open and running in the matter of 30 seconds or so. That means no power cords, no battery problems, no cold booting. Your machine should be ready to go just as soon as it's time to start coding, which may or may not be at the beginning of class. - Questions?
I'm happy to talk to you about any concerns you have before or after class, or you can always email me if you have questions or concerns. People always have questions about assignments we're working on—that's normal!—so make sure you reach out if you have a problem. We may have time to address your concern in class, or we may have to move on and deal with your individual situation at another time. There are a lot of things that can go wrong with a computer, and we may not have time to diagnose while others are waiting. (But we might! It doesn't hurt to ask!) - Bathroom business
Just go. - Be respectful.
Keeping it clean
All interactions in here need to be civil and courteous, at the very least. Better than that would be respect and appreciation for our differences. There are a wide range of abilities in here, and everyone has something to offer.
See the Code of Conduct in the Course Policies for further information.
- Be ready to work with others.
Working in Pairs
Very often in here I'll have you working with at least one other person. There are a lot of good reasons for that, but if you're the kind of person who has a hard time working with somebody else (I am!) it takes a little adjusting.
There's some good advice here in this silly but informative video.
1.2. Hardware
1.2.0. Overview
What are the physical components that make up a computing machine?
1.2.1. Anatomy of a Computer
Elements of a computer
The elements of a computer are typically the same, whether it's a laptop, a desktop, a server, a mainframe, a Raspberry Pi, or a smartphone.
- CPU—the brain of the computer that executes instructions, does math, and exchanges data with external devices and memory via a bus
- Memory Storage
- Random Access Memory (RAM)—fast but expensive, loses data when power turns off.
- Secondary storage—hard disk drives (HDD) and solid-state drives (SSD) are less expensive and persistent, but slower to access.
- Networks—wired or wireless, LAN or WAN
- Peripheral Devices—allow computer to be accessed by humans.
- Keyboard
- monitor
- mouse / trackpad
- speaker(s)
- joystick
- etc.
1.2.2. Caring for your laptop
Your laptop is a powerful tool, and an essential part of taking this course. Give it some love!
Don't throw it, drop it, or use it for a plate. Keep the screen and keyboard clean. Wrap the power cord up gently and store it carefully. Replace the battery, if needed. Don't fill up your entire hard drive. Restart your computer once in awhile. Avoid using the Chrome browser?
1.2.3. Other computer hardware you'll be using
Every time you use the Internet, your local computer or smartphone is interacting with computers that are located somewhere else on an extended network.
In this class you'll be interacting primarily with two other computers in addition to your own, "local" machine.
You're already using the crashwhite.com website, even as you read this. The other server, crashwhite.polytechnic.org, you'll learn about soon.
1.3. Software
1.3.0. Overview
Software is a general term for the programs that tell a computer how to solve a problem.
1.3.1. Programs
In order to function, computer hardware must be given a set of instructions— a program—to run. Programs are sometimes referred to as software.
Program
A program is a sequence of instructions that a computer carries out to achieve a given task.
The power of computers is that these instructions, all of them very simple, can be executed at ridiculously high speeds.
The focus of this course is to look at writing your own programs. We'll write our very first program soon.
1.3.1. Zeros and Ones - Binary Code
At the most fundamental level, computers run programs as binary code (written in 0s and 1s), and produce binary results (more 0s and 1s, sometimes represented by blinking lights) as output.
Fortunately for us, the gritty details of all of this are hidden away from us most of the time, encapsulated within the operating system and the high-level programs we'll be writing.
1.4. The Operating System: Desktop, Windows, Files, and Folders
1.4.0. Overview
One especially important collection of software is the operating system that interacts directly with the hardware to allow your computer to operate. Common operating systems include Windows, macOS, and Linux, and they each—in slightly different ways—give the user the ability to work with the computer's hardware.
While it's certainly possible interact with a computer using just 0s and 1s, almost nobody does that anymore. Over the years, computer scientists have built tools that make it much easier to give instructions to a computer: it's much easier to write code using normal numbers, text.
The operating system for a computer can be considered as one of these tools. It allows us to consider our data as being organized and presented using common metaphors: the "desktop," a "window," or a "folder." These aren't physical objects, of course, but analagous representations of those things.
1.4.1. The Desktop
Your computer screen, when you first log in, shows you a Desktop with a background image of some sort. This is a virtual area where you can temporarily keep files and folders that you're working on.
By the way, if your desktop looks like this, you have a problem.
1.4.2. Windows
Because we like to think visually, you computer will almost always provide you with a window as part of a "graphical user interface". These windows can be moved and resized by clicking on their frames and dragging the mouse.
Applications typically have windows that you can use to interact with them. If you start Firefox, Chrome, or Safari, those web browsers display a window on the screen that you can use to surf the Internet. If you log into Google and open up a Doc or look at Gmail, the browser window is displaying the digital information there.
You can also minimize a window so that it is temporarily hidden from view. Clicking on the icon for that window will make it reappear on the screen. In order to be as efficient as possible, we're going to arrange our computer windows so that we can better see what's going on.
1.4.3. File System - Files and Folders
Your file system keeps track of all of the files that are stored in your computer's memory. You can "see" where these files are stored in a few different ways: they might be on the Desktop, as shown above, or you might open a file system window that will allow you to look through the computer's memory, as shown below.
Files are stored in "folders", or directories so that we can keep things more logically organized. The file system has its own directories that it uses, and you can make your own to more conveniently keep your stuff organized.
1.5. Computational Thinking
1.5.0. Overview
Computational thinking is a problem-solving process that involves critically analyzing problems and considering strategies for solving them, with special attention given to solutions that might involve using a computer.
Let's see exactly what that means.
1.5.1. Using Computers
We use computers to get digital things done. Sending email, surfing the Internet, streaming music, sharing updates on Facebook and Instagram. Most of us use a computer of one kind or another (smartphones are computers, too!) on a daily basis.
1.5.2. Programming Computers
Some people know how to program computers. Writing code to get the computer to do what you want it to do is a skill used by game programmers, website development teams, software engineers, and others who need to have a high degree of control over the computer and how it interacts with data.
Everybody needs to know how to use a computer. Does everybody need to know how to program a computer? Some high schools now require students to take a computer programming course as a graduation requirement, and some schools offer Foreign Language credit for learning a programming language.
Think about it
What do you think about computer programming? Should everyone know how to write a computer program? Why or why not? Give evidence to support your reasoning.
1.5.3. Computational Thinking
Somewhere between using computers and programming computers is the subject of computational thinking.
Definition: Computational Thinking
Computational thinking is a problem-solving process that involves critically analyzing problems and considering strategies for solving them, with special attention given to solutions that might involve using a computer.
Not everyone needs to program a computer... but using hardware and software is increasingly a part of most people's lives. When using computers, or engaging with others who use computers, some knowledge of computational thinking is essential for you to be able to participate in that discussion.
Computational Thinking is thought of by many people as "critical thinking with computers in mind." Problem analyses that take into account solutions that are especially efficient, or that may be suitable for adapting to computers, are often more useful than those that don't.
Example of Simple Computational Thinking
I have two different routes I can drive to get from my house to my local gas station, shown here:
Which route—the East route or the West route—is the better one to take, and why?
Solution:
The East route is shorter, but it requires me to take a series of left turns, including from my house (where I have to wait for both of lanes of traffic to clear), at each intersection (where I have to wait some more), and at the gas station as well.
The West route is a bit longer, but allows me to take right turns every step of the way. I only have to wait for one lane of traffic to clear before leaving my house, I can turn right on the red lights, and it's an easy right turn in to the gas station itself.
But the final answer may depend on other factors as well: What time of day is it? How bad is traffic? Is the sun rising or setting, making it hard for me to see when I'm driving in its direction?
We haven't gotten very deep into the idea of Computational Thinking, but something that we'll be seeing soon is the idea of an algorithm.
Definition: Algorithm
An algorithm is a series of systematic steps that can be used to solve a given category of problem.
So what advice would we give to our driver above?
Think About It: The Driving Algorithm
So what's the algorithm for the best route in going from one place to another (based on our example above)? What series of steps would we recommend?
Think about it for a moment before you click on the answer.
Solution:
One answer might be:
- If there's not a lot of traffic, choose the route that travels the shortest distance.
- If there IS a lot of traffic, choose the route that has the most right turns.
The average driver may not think about these things. And maybe a smart driver would think about these things, but only have to worry about it once in awhile.
But every time you use Google Maps, or Apple Maps, or Waze, or any GPS application on your phone or in your car, that program is looking at where you are, and where you want to go, and it's trying to figure out the best way for you to get there, based in part on at least some of these factors.
1.5.4. Computational Thinking at Scale
If you had to try to repeatedly solve the problem of quickly calculating the best route to a destination and get the answer right most of the time, you'd want to try to find an algorithm that you could code into the program.
And you would arrive at that algorithm using Computational Thinking.
Over the course of these few lessons, we'll be looking at some relatively simple and concrete examples of how Computational Thinking can by used to analyze a problem. These problems are designed to be interesting and manageable, and to illustrate the process of Computational Thinking.
It's important to understand, however, that Computational Thinking skills apply to problems of all scales. A simple question:
may use the same solution that would apply to a larger question that affects thousands or millions of people:
Some problems will have relatively simple solutions, some of them might be slightly more complex... and some problems that we try to solve have no known solutions (an interesting and frustrating fact).
Computational Thinking is ultimately about trying to wrap your head around a problem to figure out a way to solve it, especially if that solution involves some ordered or systematic process that can be implemented by computers.
1.5.7. Examples of Computational Thinking
EXAMPLE 1. COMPUTATIONAL THINKING ANALYSIS (Abstract)
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
EXAMPLE 2. COMPUTATIONAL THINKING ANALYSIS (Applied)
Take a moment to watch the 5-minute video presentation here. Be sure to pause the video so that you can consider the questions being asked before going on to see the answer.
EXAMPLE 3. COMPUTATIONAL THINKING ANALYSIS (Applied)
1.c. Shopping for Groceries
Shopping for a list of groceries at the supermarket is a common task, and it can occupy a lot of time. What's the best way to go about shopping for groceries?
Consider the problem in terms of our Computational Thinking steps before looking at the solutions below.
- Problem Decomposition
Breaking down data, processes, or problems into smaller, more manageable parts - Pattern Recognition
Observing and recognizing patterns or trends in data - Abstraction/Model
Identifying the general rules or principles that are responsible for those patterns or trends - Algorithm Design
Developing instructions or procedures that can be used to solve this problem and others like it
Here's one Computational Thinking Analysis:
1. Problem Decomposition
There is a list of items, and those items are located in different parts of the grocery store.
2. Pattern Recognition
I have a random list of items to buy that aren't in any particular order. Items at the store do seem to be organized somewhat: dairy items are all in one area, cheeses are in another, and fruits and vegetables are in their own section. But those sections aren't located in consistent locations from store to store.
3. Abstraction/Model
There isn't much abstraction necessary for this analysis. The grocery list of items can be considered as a List or Array, a data structure that is used all the time in programming. The map of the store is simply an arrangement of locations that need to be visited.
4. Algorithm Design
There are two possible strategies that we might develop for doing our grocery shopping:
- Go down through the shopping list one item at a time, travelling to that part of the supermarket where that item can be found, and getting that item to put in the shopping cart. In this strategy, the list we're consulting is "in order"--we'll be assured of looking at each item on the list--but our visits to the various parts of the store are "disordered."
- Travel up and down the aisles of the supermarket, picking up items from the list as they are encountered. In this strategy, our traversal of the aisles is ordered--we're sure to visit each location in the supermarket--but our use of the grocery list itself is disordered.
1.d. Algorithm Efficiency
Which of these strategies is more efficient? Does the strategy that you choose depend on the length of the shopping list? The size of the store? The number of people you have helping you shop?
Show/hide solutionSearching algorithms don't just apply to things like buying groceries.
This graphic shows some of the different search strategies that might be employed when looking for an avalanche victim.
It's interesting that the Single Searcher pattern in this graphic looks just like my shopping strategy when I have a long list of items. Fortunately, the results of my shopping—finding where they keep the peanut butter—are a lot less critical then the results for rescue personnel.
Assignment: Lesson 2
To complete this lesson:
- Go to the Bebras Challenge, choose a Group level, and then take a few moments to solve any of the problems listed there (A problems are easiest, C problems are most challenging).
- Once you've arrived at a correct solution for each problem, (however many attempts it takes):
- Arrange your browser window and re-size it so that your problem solution is plainly visible on the left three-fourths of your screen.
- On the right one-fourth of your screen, your Desktop background and/or Desktop files should be plainly visible.
- Take a screenshot of the entire screen, including the browser window where you've been doing your work as well as part of your Desktop background. (This helps to identify your work.)
- Save your solution as
ct1.png
(orct1.jpg
, and then upload that solution to yourforInstructor
folder on the server.
1.6. Installing our Tools
1.6.0. Overview
Computers typically have a collection of applications that allow the user to interact with the operating system. Additional applications can be installed as needed.
For us, the applications that we're installing and using are specialized tools that we can use to create code, and to interact with the computer in a way that isn't possible with a commercial application. Here's what we need for our work in this course.
1.6.1. Windows Users
If you're using Microsoft Windows 10 or Windows 11, here is your checklist of things to do in preparation for this class.
- Install Linux Subsystem on Windows.
- Install Visual Studio Code, a free, cross-platform editor (see VSCode [crashwhite] and How to Install VS Code [YouTube])
- Install Notepad++, a free text editor for Windows users (recommended).
- Install Java and BlueJ, using the instructions at downloading and installing the Java SDK and BlueJ for your computer. (~30 min to complete)
1.6.2. macOS Users
If you're using Apple macOS, here is your checklist of things to do in preparation for this class.
- Visual Studio Code, a free, cross-platform editor (see VSCode [crashwhite] and How to Install VS Code [YouTube])
- BBEdit, a free text editor for Mac users (recommended)
- Install Java and BlueJ, using the instructions at downloading and installing the Java SDK and BlueJ for your computer. (~30 min to complete)
1.6.3. Linux Users
If you're using some variant of Linux (Ubuntu? Debian?), here is your checklist of things to do in preparation for this class.
- Visual Studio Code, a free, cross-platform editor (see VSCode [crashwhite] and How to Install VS Code [YouTube])
- Install Java and BlueJ, using the instructions at downloading and installing the Java SDK and BlueJ for your computer. (~30 min to complete)
1.6.4. The Terminal
The terminal is a program, a type of command-line interface that we can use to operate the computer.
The terminal is not the way that most people use a computer, but it's one of the way that programmers and developers use a computer.
Terminals are what hackers use. :) It is perhaps the fundamental tool that you should have some familiarity with. You'll be working with it every day in here!
Learn about the terminal and our server here.
1.7. Encapsulation and Binary
The idea of encapsulation is fundamental to computers, and to a number of other ideas. Generally speaking, "encapsulation" refers to the idea of building a container around something, as if that thing were contained in a capsule.
In the same way, the binary number system, consisting solely of 0
s and 1
s, is fundamental to how a computer works.
Take a moment to look through each of these presentations: