CSE 331: Topics
1. Specifications and Procedural Abstraction
Even when we are asking AI to write code for us, since AI cannot read our minds, it is important to be able to write a clear specification, stating in precise terms what that code needs to do. In this topic, we will discuss whole-program software specifications and method specifications.
- Lecture 1: Sum.java
- Homework 0
-
Lecture 2: Handout on method specifications and Handout with
indexOfexamples -
Section 1 slides and
solution slides and
Section 1 worksheet and Section 1 solutions and
Handout with
removeValueexamples -
Homework 1. Change log:
- (6/27/26 5pm) Updated the starter code to describe the expected output format for Task 4. Please update to the most recent starter code or review the differences.
-
(6/29/26 9am) Fixed the expected output values. The values contained in the
expected output file were incorrectly computed by dropping 1 HW score
instead of 2 as specified in
categories.csv. This has now been fixed.
2. Testing & Interactive Programs
Testing gives us some confidence (though not complete confidence) that the implementation satisfies the specification by checking it on a well-designed set of test cases.
- Lecture 3: Handout on testing
- Lecture 4: Handout on more testing and code coverage
- Lecture 5: Calculator.java and Handout on error handling and interactive programs
- Section 2 slides and Section 2 solution slides and Section 2 worksheet and Section 2 solutions
3. Reasoning about Assertions
Reasoning is a technique programmers use to determine what is true at different points in the program. In this topic, we will study global (whole-program) and local (within one method) reasoning, and connect the two together.
- Lecture 6: Handout on reasoning
- Lecture 7: Handout on Floyd-Hoare logic
- Section 3 slides and Section 3 solution slides and Section 3 worksheet and Section 3 solutions
- Lecture 8: Handout on Loop Invariants
4. Abstract Data Types
Moving up the scale of program complexity from methods to classes, we discuss how to specify and reason about a class that does not expose its fields to clients. Since the clients don't know about the fields, the specifications must be written "abstractly", using some kind of description that makes sense to clients.
- Lecture 9: Handout on ADTs
- Section 4 slides and Section 4 solution slides and Section 4 worksheet and Section 4 solutions
- Lecture 10: Handout on "More ADTs"
- Lecture 11 and 12: Practice Midterm and Practice Midterm solutions
- Section 5 slides and Section 5 solution slides and Section 5 worksheet and Section 5 solutions
Midterm
5. Subtyping, Equality
- Lecture 13: Handout on Subtyping
-
Lecture 14: Handout on Equality,
Object.equals()andObject.hashCode() - Section 6 slides and Section 6 solution slides and Section 6 worksheet and Section 6 solutions
- Homework Inventory.
6. Generics, Web Development in 1995
- Lecture 15: Handout on Generics
- Lecture 16: Handout on Web Development. See also the no-JS web development guide.
- Lecture 17: Handout on Design Patterns
- Section 7 slides and Section 7 solution slides and Section 7 worksheet and Section 7 solutions
- Homework Inventory++.
7. Design Patterns, Basic JS Web Development
- Lecture 18: Dafny demo files (zip) or Dafny demo files(browse)
- Lecture 19: Handout on Design Patterns (2)
- Lecture 20: Handout on Web Development (2). See also the Vanilla JS web development guide.
- Section 7 slides and starter code
- Homework Library.
8. More Design Patterns, React, Exam prep
- Lecture 21: Handout on Web Development (3).