Week 1 - Class Overview and Structs
Learning objectives
- Use structs to represent heterogeneous collections of data
- Combine structs and vectors to represent collections of complex data
- Use enumerations to represent related constants
Recommended Schedule
You have a lot of freedom to choose when you get the work done each week.
There is a recommended schedule below to help you break up the work into manageable chunks. Trying to do all of your learning in one monster day of studying tends to be much less effective than working on smaller chunks of the material more often.
Although the major assignments are always due at the start of next week, there are often mid-week deadlines for other work (check Canvas for all due dates), so you can't wait until the weekend to get everything done.
If your schedule requires you to do most of your work for this class on the weekend, you should try to work ahead on the next week each weekend rather than playing catchup from the previous week. That way you have plenty of time to ask questions and get any needed help before your assignments are due.
Day 1
Day 2
- GenAI and You
- Start Ch 15 on Structs (15.1-15.6)
- Start Structs exercise set (you won't be ready for the problems involving vectors yet)
Day 3
- Continue Ch 15 - Enums and structs and vectors (15.7-15.10)
- Do Enums exercise set
- Finish Structs exercise set
Day 4
- Finish reading Ch 15
- See Structs and Headers below
- Work on Week 1 assignment
Course Intro
If you have not already watched the course intro video, do so now:
In Canvas, review the syllabus and take the class policies quiz. You can take it as many times as you like before the deadline. So make sure to get 100% on it!
Access Book
Watch this video to see how to use the book and complete the book based assignments.
Videos with the notice "Important Video" contain information that is NOT covered in the book. You should make sure to watch these videos.
Videos that do not have that notice are optional supplements to the book material.
Not all assignments will be completed in the book. Canvas (Elearn) should be your primary source for assignments and due dates.
Setup
You need to have a working development environment for this course. One option is to use Github Codespaces. The other is to set up a local development environment on your computer.
Eventually, you are going to need to have a local environment, but if you have not done either in the past, using Codespaces is often easier to get started with quickly. Codespaces also has the advantage of being the same environment that I will be using for demos - there will be times when differences in local setups (OS, installed tools, etc...) can cause confusion. So even if you normally use a local setup, you will want to know how to switch to a codespace if needed to accomplish something.
So do the following:
If you have not used Codespaces before, follow the Codespaces guide for instructions on how to set up and use a Codespace.
Setup/update a local development environment, follow the Local Development Setup instructions to set up your computer. Make sure to update the templates you are using!
There will be a mini-assignment soon that requires you to show a screenshot of your local development environment working. So even if you prefer to work in a Codespace, get your local environment set up now. If you run into issues, please get help on Discord, the discussion board, or during office hours.
I recommend setting up a Codespace or making a local project that you use for testing. Any time you just want to test out a code sample or do an experiment, use that Codespace or local project.
When you are working on an assignment you will submit, create a new repository for that assignment.
GenAI and You
Generative AI is a powerful tool for programmers. It can also be a helpful tool for learning computer science. However, in both contexts, there are downsides and risks to be aware of.
There are many ethical and practical considerations in regard to Generative AI. Was the training data obtained ethically? Are there biases in the training data? Is the output correct? Is it secure? Who benefits from automating labor that a human might otherwise do?
But from a very immediate perspective, you should be concerned about what your goals are in a CS course and how using Generative AI might hinder your ability to meet those goals.
This video discusses some of these issues and provides guidance on how to use (and not use) Generative AI effectively as part of your learning process.
Structs
Read Chapter 15.1-15.6 on Structs in the textbook.
This optional video covers key ideas:
Enums
Chapter 15.7 and 15.8 covers enumerations (enums).
This optional video covers the key ideas:
Structs and Vectors
Chapter 15.9 and 15.10 covers using structs and vectors together.
Watch this video that demonstrates how to use the debugger to inspect complex composite data types using both structs and vectors:
This optional video reviews key ideas about combining structs and vectors:
An idea that is covered by the book but is worth emphasizing is the difference between a copy of a struct and a reference to a struct. Watch this video for a deeper explanation of that concept:
Structs and Headers
Watch this video about using structs across multiple files:
If you need a deeper refresher on how .h files work, watch the video below and then review the Using .h/.cpp files walkthrough from CS161. Full coverage of .h/.cpp files can be found in Chapter 6.
Do Assignment 1
Start working on the first submitted assignment. It is listed as "Assignment 1" in Canvas.
Most weeks will include an assignment you will complete outside of the book and submit in Canvas. As part of starting the first assignment, you should make sure to read this document about the work history you must submit as part of every assignment.
There is a video in that document that shows how your work history is documented and how to inspect that history.
When you are complete, here is how to submit your assignment:
Unit Testing Review
If you did not take CS161 here, you will want to watch these two videos about unit testing: