help: you are in week 5 of 15
--> lecture 12 of 40, Wed Sep 30
| | Project 1 due Fri Oct 2
|^^^^^^^^^ next | Midterm 1 Fri Oct 9
| =note: a strong finish canoutweigh a rough start
How to use this page
Each lecture below has two main items. Watch is a short visual explanation, 15 minutes or less. Do is a small exercise that tells you right away if your code works. Together they take about half an hour. Go deeper items are optional.
Do the course pre-work before each lecture, because it counts for your grade. Use this page after the lecture, or any time a topic did not make sense.
Why an exercise every time? On the exams, you write Rust by hand with no computer. Videos build understanding, but only writing code builds that skill.
The next ten days: Project 1 and Midterm 1
Now to Friday, October 2: finish Project 1
Run the tests often. cargo test --bin game runs all of them. The project commands show how to run only the tests for one function.
Commit and push each time something works. Your code review looks at your commit history.
If the ideas behind the strategies feel fuzzy, two short videos help. Big O Notation by HackerRank (9 min) shows why some programs slow down much faster than others as the input grows. Binary Search Animated by Dreams of Code (7 min) counts the steps that a halving search needs, compared with checking one number at a time.
That second video asks “is it this one?” at every step, so follow the handout's own rules for each strategy. Work out your writeup answers from your own plot first. If a video helps you, cite it in your README, as the course requires.
If you are stuck, go to office hours before Friday. The times are in Where to get help. Work that is up to 48 hours late can still earn up to 80% of the credit.
Saturday and Sunday: catch up on lectures 6 to 13
Do the Watch and Do items for each lecture in weeks 3 to 5. If time is short, start with lectures 7, 8, 11, 12, and 13. The midterm asks you to write that kind of code by hand.
Monday to Wednesday: prepare for your Project 1 code review
Your code review is in your discussion section this week: Tuesday for B sections, Wednesday for A sections. Open each function that you wrote. Say out loud what it does, why you wrote it that way, and one other way to write it. Get ready for a code review lists the kinds of questions.
You must attend. If you miss your code review, the whole project scores zero.
Monday to Thursday: practice writing code on paper
Redo the Discussion 4 problems without notes. Then do the practice problems below. Write each answer on paper first. Then type it into the Rust Playground to test it.
The course's Activity 9 is Big-O practice in the format of the exam, with solutions at the end. For more, these problems match lectures 6 to 13. Exercism and LeetCode need a free account to run your code. Without an account, write the function on paper, and then test it in the Rust Playground with a few assert_eq! lines.
grains (Exercism): lecture 6, u64 and powers of 2.
high-scores (Exercism): lectures 11 and 13, a struct around a Vec, an Option, and .sort().
yacht (Exercism, medium): lecture 12, an enum and match.
Wednesday, October 7: bring questions to the review lecture
Lecture 15 reviews everything before the midterm. Write down the topics that still feel shaky, and ask about them.
Friday, October 9: Midterm 1
The exam is in class. You cannot use notes, a calculator, scrap paper, or any device, and you cannot wear a smart watch or smart glasses.
Set up once
Most Do items use one of these four tools.
The Rust Book, Brown University edition is the official Rust Book with short quizzes and memory diagrams added. Take each quiz before you reveal the answers, because you cannot retake a quiz after that.
Rustlings is a set of small broken programs that you fix one at a time. Each time you save, it runs your code again and tells you if it works. To install it, run these commands in the terminal once. The first command keeps Rustlings out of your project folder.
cd ~
cargo install rustlings
rustlings init
cd rustlings
rustlings
If the install fails, run rustup update and try again. Press h for a hint and l for the list of exercises. If Rustlings does not notice when you save, start it with rustlings --manual-run, and press r to run the current exercise. After you solve an exercise, Rustlings shows a model solution. Write your own answer first, and then compare.
The Rust Playground runs Rust in your browser, with nothing to install. Use it to test code that you wrote on paper. Its Share button makes a link that you can send to a TA.
Exercism's Rust track has 99 exercises that run in the browser, with tests. You need a free account.
If you like video better than reading, Let's Get Rusty made one video for each chapter of the Rust Book. The videos are from 2021, but chapters 1 to 16 still match the book.
Every week
The weeks follow the course schedule. The page opens the current week for you.
Week 1, Sep 2 to 4: Tools and your first program
Discussion: No discussion.
L1. Welcome: what this course is, and why RustWed Sep 2
Watch
Rust in 100 Seconds by Fireship, 3 min. A fast, animated tour of what Rust is and why people choose it. It mentions ownership and borrowing, which come in October, so do not worry about those parts yet.
Go deeper
Rust for the impatient by No Boilerplate, 11 min. A very fast slide tour of Rust syntax. Watch it now for the big picture, and again before Midterm 1 as a review.
L2. Hello shell: talking to your computerFri Sep 4
Watch
Linux Directories Explained in 100 Seconds by Fireship, 3 min. An animated folder tree from the root / down to your home folder ~, with cd, ls, and which beside it. On a Mac, your home folder is /Users/ plus your name. In Git Bash, the C: drive shows up as /c.
Do
Command Challenge: do the first nine challenges. Each answer runs in a real bash shell, and the site tells you at once if it is right.
Go deeper
Absolute and Relative Paths by Udacity, 2 min. A hand-drawn folder tree that shows how to write a path with ., .., and ~. Julia Evans's comic unix permissions decodes an ls -l line. If you liked bashcrawl, try Terminus, a similar game from MIT.
Week 2, Sep 7 to 11: Tools and your first program
Due: Project 1 released Friday. Discussion: Install session. Monday, September 7: Labor Day, no class.
L3. Hello Rust: your first program, and why it is fastWed Sep 9
Watch
Interpreters and Compilers by Bits and Bytes, a 1983 TV show, 4 min. A short cartoon. An interpreter starts right away but runs slowly. A compiler needs time first, but then the program runs fast. That is why Rust beats Python at adding up ten million numbers.
Do
The quizzes in Brown 1.2 Hello, World and 1.3 Hello, Cargo. Then install Rustlings (see Set up once) and pass intro1 and intro2. If the terminal says "command not found", that is the PATH problem from this lecture.
L4. Hello git: save points for your codeFri Sep 11
Watch
How Git Works: Explained in 4 Minutes by ByteByteGo, 4 min. Animated lanes for your files, the staging area, your local repository, and GitHub, with the command that moves code between each pair. This is the lecture's “one repo, two copies, and a staging area”. The last minute uses git switch, which does the same job as git checkout.
Do
Drill the everyday loop in a practice folder, for example your hello_rust project. Change one line. Then run git status, git diff, git add, git commit -m, and git log, in that order. Read what each command prints. Then change a line again, and undo the change with git restore.
Go deeper
Julia Evans's comic the staging area draws the path from a changed file to a commit.
Git Will Finally Make Sense After This by LearnThatStack, 13 min. Fully animated, close to the 3Blue1Brown style. A commit is a snapshot, a branch is a sticky note that points at a commit, and git revert undoes a commit by adding a new one. Skip the parts on reset --hard, rebase, and reflog, because the course does not use them.
Do
Repeat the lecture's compiler error hunt at home. Paste the program into the Rust Playground, and run it. Break it in one small way, run it again, and read the error. Undo the change, and break it another way. Aim for eight different errors.
L6. Variables: types and their propertiesWed Sep 16
Watch
Twos complement: Negative numbers in binary by Ben Eater, 14 min. Worked out by hand, on paper. It shows why computers store negative numbers in two's complement, which is the lecture's “Why Two's Complement?” slide.
L7. Functions: parameters, returns, and expressionsFri Sep 18
Watch
Rust for the impatient, from 2:50 to 4:00 by No Boilerplate, 1 min. A fast slide show of the semicolon rule. A block is an expression, and a semicolon turns it into a statement. Pause often. One slide says “void”, where Rust says the unit type ().
Do
Rustlings 02_functions (functions1 to functions5). functions5 is the extra-semicolon mistake. Then take the quiz in Brown 3.3 Functions.
Why You Shouldn't Nest Your Code by CodeAesthetic, 8 min. Animated. It flattens nested if statements by returning early, which is the same rewrite as the lecture's “Same checks, returning early”. The code is not Rust, but the idea is the same. At 2:20, the comparison must be <=, not <, as the creator corrected.
Do
Rustlings 03_if (if1 to if3). Then take the quiz in Brown 3.5 Control Flow, which asks about if as an expression, labeled loops, and for loops over arrays.
L9. Complexity: how to compare two programsWed Sep 23
Watch
Big O Notation by HackerRank, 9 min. Hand-drawn, animated examples of linear, quadratic, and other growth rates, by the author of Cracking the Coding Interview. It does not cover debug versus release mode.
Do
Redo the course's Activity 9 on paper: the time and space complexity of five short Rust functions. Then compare your answers with its Solutions section.
Go deeper
What Is Big O Notation? by Reducible, 18 min. Made with the animation library of 3Blue1Brown. It is the closest thing to 3Blue1Brown for this topic.
L10. Sorting: complexity and recursionFri Sep 25
Watch
Merge sort in 3 minutes by Michael Sambol, 3 min. The same picture as the lecture: split the pile into levels, then merge back up, which gives O(n log n).
Do
VisuAlgo sorting: enter the lecture's cards 60,30,80,10,50,20,70,40, and step through selection sort, insertion sort, and merge sort. Then take the easy sorting quiz. It needs no login.
Go deeper
Call Stacks by CS50, 8 min. Shows the stack frames of a recursive function, the same idea as the lecture's trace of sum_to(3). The examples are in C. If you read the Rust documentation, it names the algorithm behind .sort() driftsort, a newer mix of merge sort and quicksort. On the exam, give the lecture's answer.
Week 5, Sep 28 to Oct 2: Structuring data
Due: Project 1, Friday, October 2. Discussion: Project 1 work session.
L11. Structs: bundling data with methodsMon Sep 28
Watch
Methods for Structs by Francesco Ciulla, 11 min. Uses the Rust Book's Rectangle example: methods with &self at 1:20, and constructors called with :: at 7:37. It is a person talking over code, because no good animated video on structs exists.
Do
Rustlings 07_structs (structs1 to structs3) and 05_vecs (vecs1 and vecs2). structs3 turns plain functions into &mut self methods, with a new constructor. If you read Brown chapter 5, skip the part called Methods and Ownership. It needs the ownership lectures from October.
Rust Data Modelling Without Classes, from 0:00 to 3:05 by No Boilerplate, 3 min. Shows why an enum beats a struct full of true-or-false flags, and how match makes the compiler catch a missing case. Stop at the “Part 1” title card.
Do
Rustlings 08_enums (enums1 to enums3). enums3 uses match to call &mut self methods, so it also reviews lecture 11. Then take the quiz in Brown 6.2 match.
Go deeper
Enums and Pattern Matching in Rust by Let's Get Rusty, 13 min. A slower walk through the same chapter: enums at 0:41, Option at 4:16, and match at 6:56.
L13. Errors: Result, Option, and reading a fileFri Oct 2
Rustlings 12_options (options1) and 13_error_handling (errors1 to errors3). Then read Brown 9.2. It ends with fs::read_to_string, and its quiz asks what ? does.
Go deeper
Option - Rust Building Blocks by Max Taylor, 5 min. A short animation of a value that can be missing, compared with how Python and TypeScript handle missing values. Reading Files in Rust by Francesco Ciulla, 8 min. Reads a file three ways: with no error handling, with match, and line by line.
Week 6, Oct 5 to 9: Review and Midterm 1
Due: Midterm 1, Friday, October 9, in class. Discussion: Project 1 code review. Project 2 is released on Friday.
L14. Read and review code: a real repo, and your ownMon Oct 5
Review your own Project 1 code with Google's checklist What to look for in a code review. Look at the names, the comments, and the complexity in strategies.rs. Then answer the Discussion 4 mock-review questions about your own code, out loud.
Go deeper
How to Read Complex Code? by Felienne Hermans at GOTO 2021, 33 min. A talk based on research, by the author of the book The Programmer's Brain.
L15. Review: everything before Midterm 1Wed Oct 7
Watch
Rust for the impatient by No Boilerplate, 11 min. The fast tour from lecture 1 again, as a syntax review. You now know most of it.
Due: Project 2 checkpoint 1, Friday. Discussion: A sections only: extra practice. Monday, October 12: holiday. Tuesday follows the Monday schedule.
L17. The stack: frames, and why it is fastTue Oct 13
Watch
Why Is the Stack So Fast? by Core Dumped, 14 min. Animated. What a stack frame is, and why the stack is fast. It works at the level of C and the operating system, not Rust.
L20. Pointer danger: five ways C loses your memoryMon Oct 19
Watch
how can memory safe code STOP HACKERS? by Low Level, 8 min. The memory bugs of C, and how Rust prevents them. A person talking over code. The Do item is the visual part of this lecture.
Do
Each of these links runs a tiny C program in Python Tutor that has one bug: use after free, double free, buffer overflow, and uninitialized pointer. Predict the line that fails. Then click Next until Python Tutor reports the error. It cannot show the fifth bug, a memory leak: the leaked block just disappears from the drawing.
L22. Owning collections: Vec, String, and capacityFri Oct 23
Watch
The Simple and Elegant Idea behind Efficient Dynamic Arrays by Reducible, 8 min. Made with the same animation library as 3Blue1Brown. It shows how a growing array doubles its capacity, and why a push is still fast on average. Ideas only, no code.
Do
The quizzes in Brown 8.1 Vectors. They ask whether small programs compile, for example one that pushes to a Vec while it loops over it.
Due: Project 2, Friday, October 30. Discussion: To be announced.
L23. Strings: why text is harder than it looksMon Oct 26
Watch
Unicode, in friendly terms by Studying With Alex, 11 min. Characters, code points, and bytes, and why “the first character of a string” is not a simple question. At 7:52 it shows the same ideas in Python.
Do
Rustlings 09_strings (strings1 to strings4). strings4 asks you to label each value as a String or a &str.
Brown 4.3 Fixing Ownership Errors, a chapter that only the Brown edition has. For each of its six case studies, decide if the program is really unsafe, and then pick the fix.
Go deeper
When you meet a borrow checker error, read its page in the error index. These are the common ones: E0382 (use after move), E0499 (two &mut at once), E0502 (& and &mut at once), E0505 (move while borrowed), E0506 (assign while borrowed), E0597 (value dropped while borrowed), and E0106 (missing lifetime). but what is 'a lifetime? by leddoo, 12 min. A way to think about lifetimes. It is more abstract than the other picks.
Week 10, Nov 2 to 6: Tests and Midterm 2
Due: Midterm 2, Friday, November 6, in class. Discussion: Project 2 code review. Project 3 is released on Friday.
L26. Tests: writing them, and what to testMon Nov 2
Watch
Testing in Rust by Let's Get Rusty, 15 min. Walks through the Rust Book's chapter on tests: #[test], assert!, assert_eq!, and #[should_panic]. A person talking over code, because no animated video on Rust tests exists.
Do
Rustlings 17_tests (tests1 to tests3). tests3 adds tests for edge cases, such as a negative width.
Go deeper
Testing in Rust - Part 2 by Let's Get Rusty, 14 min. Shows how running tests by name works, which is what cargo test --bin game cp2::binary did in Project 1. Then try the Luhn algorithm exercise from Comprehensive Rust. Its code has bugs but passes its two tests. Write tests for edge cases until they fail, and then fix the bugs.
L27. Review: everything before Midterm 2Wed Nov 4
Do
Draw memory by hand, because the exam asks you to reason about the stack and the heap without a computer. In Brown 4.1 and Brown 4.2, cover each diagram. Draw the stack and the heap for that line on paper. Then compare your drawing with the diagram.
Due: Project 3 checkpoint 1, Friday. Discussion: To be announced.
Project 3 ideas: how computers play games
These explain the ideas behind a game-playing agent, with no project code. Code tutorials for a tic-tac-toe AI exist. Skip them, because your code review asks you to explain every line that you wrote.
Watch
Minimax: How Computers Play Games by Spanning Tree, 15 min. Animated game trees for tic-tac-toe. It covers minimax, alpha-beta pruning, and evaluation functions, in pseudocode only.
Do
Alpha-beta pruning practice from UC Berkeley makes random game trees. Mark the branches that alpha-beta pruning skips, and it tells you at once if you are right.
The logger trait exercise from Comprehensive Rust. You write a type that wraps a logger and implements the same trait.
L30. Generics: one function, many typesWed Nov 11
Watch
Rust Powered Polymorphism With Traits by Code to the Moon, 10 min. One function that works for many vehicle types, written three ways. The generic version, with <T: LandCapable>, is the one this lecture teaches. The dyn version goes beyond the lecture.
Do
Rustlings 14_generics (generics1 and generics2). Then the generic min exercise from Comprehensive Rust: write fn min<T: Ord>(l: T, r: T) -> T so that its tests pass.
Go deeper
Generic Types in Rust by Let's Get Rusty, 15 min. The Rust Book's chapter 10.1: generic functions, structs, and enums. The types, traits, and generics section of cheats.rs has diagrams, but it is dense.
L31. Collections: Vec, HashMap, and what they costFri Nov 13
Watch
Hash Tables and Hash Functions by Computer Science Lessons, 14 min. Diagrams of how a key picks a slot, and what happens when two keys want the same slot. This is why a HashMap lookup is O(1) on average.
Do
Two Sum (LeetCode 1). Solve it first with nested loops, which is O(n²). Then solve it with a HashMap, which is O(n). Explain the difference in one sentence.
Go deeper
ArrayList vs LinkedList by Core Dumped, 21 min. Animated. A growable array, like Vec, compared with a linked list, down at the level of memory.
L32. Heaps: building a collection from a VecMon Nov 16
Watch
Data Structures: Heaps by HackerRank, 11 min. A hand-drawn heap. Inserting swaps a value up, and removing swaps a value down. Then it stores the tree in an array, where the parent of index i is at (i - 1) / 2. The second half is Java code. This heap is a data structure, not the memory heap from lecture 18.
L33. Linear structures: stacks, queues, ring buffersWed Nov 18
Watch
Circular Queue Implementation - Array by Blue Tree Code, 10 min. Draws the array as a ring, with markers for the front and the rear. The next slot is (rear + 1) % length.
Do
Valid Parentheses (LeetCode 20), with a stack built on a Vec. Then Design Circular Queue (LeetCode 622), a ring buffer on a fixed-size Vec. In its Rust template, change &self to &mut self for each method that changes the queue.
Rustlings box1 in 19_smart_pointers. Newer versions of Rustlings call it smart_pointers1. Put the recursive variant in a Box so that it compiles, and then build an empty list and a list with items. For more practice, Exercism's simple-linked-list builds a list with push, pop, and peek.
Due: Project 3, Friday, December 4. Discussion: To be announced.
L36. Iterators: closures, laziness, and filesMon Nov 30
Watch
Iterators in Rust by Let's Get Rusty, 13 min. next(), lazy adapters such as map and filter, and collect. A person talking over code.
Do
Rustlings 18_iterators: iterators2 (map and collect), then iterators5, which replaces for loops with filter, a closure, and count.
Go deeper
read_lines in Rust by Example reads a file line by line with BufReader. Closures in Rust by Let's Get Rusty, 20 min. How closures capture values, and what move does.
L37. Threads: doing two things at onceWed Dec 2
Watch
Threads On Multicore Systems by Core Dumped, 11 min. Animated. Shows how several threads run at the same time on different cores. No Rust code.
L38. Sharing data: Arc, Mutex, and data racesFri Dec 4
Watch
Why Python Is Removing The GIL by Core Dumped, 14 min. Animated. Python protects shared data with one big lock, and the video shows why and what that lock costs. Rust's Arc and Mutex solve the same problem in a different way.
Do
Rustlings threads2 in 20_threads: wrap the shared counter in Arc<Mutex<...>>, and lock it before you change it. Then arc1 in 19_smart_pointers. Newer versions of Rustlings call it smart_pointers3.
Due: Final exam, Monday, December 14, 12 to 2 pm, CGS 505. Discussion: Project 3 code review.
L39. Review: rapid fire across the termMon Dec 7
Watch
Rust for the impatient by No Boilerplate, 11 min. The fast tour from lecture 1 again. Now you know almost every part of it.
Do
The three Rustlings quizzes. quiz1 covers variables, functions, and if. quiz2 covers strings, Vec, moves, modules, and enums. quiz3 covers generics and traits.
Go deeper
cheats.rs, a one-page visual reference for the whole language.
L40. Review: long form, and your questionsWed Dec 9
Do
Take the Brown Rust Book quizzes on the main topics of the term. Ownership: 4.1, 4.2, 4.3. Collections: 8.1, 8.2, 8.3. Errors: 9.2. Generics: 10.1. Tests: 11.1. Closures and iterators: 13.1, 13.2. Shared state: 16.3.
Every Rust compiler error has the same five parts:
An error code, for example E0596.
A one-line summary of the problem.
The location, as file, line, and column.
Your code, with carets (^^^) under the exact spot.
Often, a suggested fix on a line that starts with help:.
To learn more about an error code, run rustc --explain E0596 in the terminal, or find the code in the Rust error index. Fix the first error first, because one mistake often causes more errors further down. The fix does not always belong on the line that the error names.
Two more commands help before you submit. cargo fmt formats your code in the standard style. cargo clippy points out code that works but can be simpler. Appendix D of the Rust Book explains both.
The commands the course expects you to know
This list comes from lecture 5. The exams can ask about any of them.
pwd
Prints the folder that you are in.
ls, ls -a, ls -l
Lists files. -a also shows hidden files. -l shows details, for example permissions.
cd, cd .., cd ~
Moves into a folder, up one level, or to your home folder.
cat, which
Prints a file. Shows where a program is installed.
mkdir, touch
Makes a folder. Makes an empty file.
cp, mv
Copies. Moves or renames.
rm, rm -rf
Deletes a file. Deletes a folder and everything in it. Before you use rm -rf, read the path twice, because there is no undo.
echo "text" >> file
Adds a line to the end of a file.
nano
Edits a file inside the terminal.
git init, git clone
Starts tracking a folder. Copies a repository from GitHub to your laptop.
git status
Shows what changed and what is staged. Run it before and after every other git command.
git add, git commit -m
Stages a change. Saves the staged changes with a message.
git push, git pull
Sends your commits to GitHub. Gets new commits from GitHub.
git log, git diff
Shows the history. Shows the exact lines that changed.
git restore
Throws away changes that you did not commit.
git revert
Undoes a commit by adding a new commit, so the history stays intact.
git branch, git checkout, git merge
Lists or makes branches. Switches branches. Combines another branch into the current one.
cargo new
Makes a new Rust project.
cargo check
Looks for errors without building. It is the fastest way to see errors.
cargo build, cargo run
Compiles your code. Compiles and runs it.
cargo run --release
Compiles with optimizations and runs. Use it when you measure speed.
cargo test
Runs the tests.
rustc
Compiles one file without Cargo.
Project commands
These come from the Project 1 handout. Later projects use the same pattern.
cargo test --bin game cp2 # all checkpoint 2 tests
cargo test --bin game cp2::binary # only tests with this text in their names
cargo run --bin game -- --strategy random --min 2 --max 6
cargo run --bin plot # draws plot.png and prints the table
Each test name tells you the function that it tests and one thing that can go wrong. Read the name of a failing test before you read its code. To see what your own strategy does, play it on a small range, where you can follow every question. The Rust Book explains name filters in Running a Subset of Tests by Name.
When git refuses
Read what git prints. It often includes the exact command that fixes the problem. Run git status to see where you are.
A merge conflict means that two versions changed the same lines, and git will not guess which one you meant. Git puts both versions in the file between <<<<<<<, =======, and >>>>>>> lines. Decide what the combined code must be, and delete all three marker lines. Then run the tests, git add the file, and git commit.
If git says “refusing to merge unrelated histories”, use the exact commands in the Project 1 handout. General guides for syncing a fork leave out the extra step that a template copy needs.
Never fear merge conflicts again by Philomatics, 5 min. An animation of the two branches, then a real conflict in VS Code. It shows why the Accept Current and Accept Incoming buttons can both be wrong, and how to combine the two sides by hand.
What is origin in Git? by Anna Skoulikari, 7 min. Shows that origin is only a short name for a URL, and adds a second remote. That is what the upstream step in Project 1 does. The video names its second remote friend, not upstream.
Set up VS Code the way the course asks
Your professor asks you to turn off Copilot's completions, because they do the struggling for you, and the struggle is how you learn. VS Code calls them inline suggestions. Click the Copilot icon at the bottom right of VS Code, and turn them off.
The VS Code instructions show the same steps. The Snooze button turns the suggestions off for only a few minutes.
Keep rust-analyzer on. It underlines errors as you type, and its inlay hints show the type of each variable in gray, for example : i32. If you do not see them, read the inlay hints section of the VS Code guide for Rust.
Use AI the way the course allows
The course lets you use AI to understand concepts, to debug your code, and to get ideas. You must understand every line that you submit, because the code reviews and the exams test that. Your professor's workflow, from lecture 5:
Think on paper. What must the code do? What are the steps?
Write the steps in plain English, as comments, before you write any Rust.
Write the parts that you can.
Ask for help with the specific thing that you are stuck on.
Read the answer until you can write it yourself.
Good questions for an AI: "What does this compiler error mean?" "What is the name of the function that does this?" "Explain this concept in a different way." Tell the AI to answer your questions and not to edit your files.
If you use AI on a project, write in your README what you used and how. For example: "I asked ChatGPT to explain error E0308 in strategies.rs. I wrote the fix myself." Course staff will not help you debug code that AI wrote.
Get ready for a code review
Half of each project grade is a code review. A course staff member goes through your code and your commit history with you. The Discussion 4 practice guide shows three kinds of questions:
Explain this to me. Why did you write it this way?
What if this were different? How does your code change if the input or the data type changes?
Did you actually write this code? Point to the line that does a specific job, and explain it.
The real review also asks about git. Full marks go to answers that are correct and that explain why, without a hint.
To practice, take each function in your project. Say out loud what it does, why you wrote it that way, and one other way to write it. Then say what happens with an edge case (an unusual input at the limits), for example an empty list or the largest possible number.
Where to get help
Prof. Wheelock holds drop-in office hours on Mondays and Wednesdays, 9:30 to 10:30 am, in CDS 1506. You do not need to sign up.
TAs and course assistants hold office hours on the 5th floor of the CDS building: Monday 5 to 6 pm, Wednesday 4 to 6 pm, Thursday 4 to 6 pm, and Friday 1:30 to 3:30 pm.
Ask questions on Piazza. The staff answers there faster than by email.
If you miss a lecture, watch its recording on Echo360 with your BU login. The links for sections A1 and B1 are in the syllabus, under Course Websites.
Safety nets in the syllabus
The course gives you several ways to recover from a rough start:
A missed checkpoint costs only that checkpoint's point. The code still earns credit when you submit the project.
Work that is up to 48 hours late can earn up to 80% of the credit.
About two weeks after each midterm, you redo questions in person. Your midterm grade becomes the average of the two scores, so you can earn back half of the points that you lost.
If your final exam score is higher than your midterm average, the final counts for 30% and each midterm for 10%. The course does this for you automatically.
In each attendance period, you can miss two lectures or one discussion with no penalty.
The course drops two or three pre-work scores in each third of the term.
These safety nets do not cover code reviews. You must attend each one. If you cannot, tell the staff at least two days before.
Coming from Python
Rust side by side with Python
Microsoft's free book Rust for Python Programmers shows each idea in Python first and then in Rust. These chapters match your lectures: