CSE 331: Topics
The course is organized into 10 topics. We plan to cover one topic per week.
1. Specifications & Testing
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 look at how specifications for methods are written in Java.
-
Lecture Topic 1 slides (PDF)
- Summary of testing requirements
- Section 1 slides and solution slides and Section 1 worksheet (HTML) (Section 1 worksheet PDF) and Section 1 solutions (HTML) (Section 1 solutions PDF)
2. Testing & Immutable Reasoning
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.
To gain even more confidence in correctness, we turn to reasoning. First, we will reason about code that does not change the values on any local variables (so-called "functional" code).
- Lecture slides
- Section 2 slides and solution slides and Section 2 worksheet (HTML) (Section 2 worksheet PDF) and Section 2 solutions (HTML) (Section 2 solutions PDF)
-
Homework 1 Written and Homework 1 Coding
Change log:
- Updated zip to include Florist2.java and Florist2Tests.java for second implementation
- Task 4 conditional inside loop changed to match spec. Updated part b tests.
3. Reasoning about Local Variable Mutation: Floyd Logic
Now we will learn how to reason about code that changes the values of local variables using a technique called Floyd logic. Different properties will be true at different points in the program, based on the current values of the variables. We will learn how to propagate knowledge about what is true at different program points across assignment statements, conditionals (if statements), and loops.
- Lecture slides (combined with topic 2 slides; see above)
- Section 3 slides and solution slides and Section 3 worksheet (HTML) (Section 3 worksheet PDF) and Section 3 solutions (HTML) (Section 3 solutions PDF)
- Homework 2 Written
4. Mutation and Data Abstraction
- Lecture slides
- Section 4 slides and solution slides and Section 4 worksheet (HTML) and Section 4 solutions (HTML)
-
Homework 3 Written
Change log:
- Task 3 part d code fixed. Correct variables names and length now reflected.
5. Reasoning About Arrays
In this topic, we will look at how to reason about code with array indexing. As we will see, this creates potential bugs that cannot occur with lists. Array indexing gives us extra power but comes at a cost of more complex reasoning, requiring the use of prefixes, suffix, and “for any” facts to describe their states.
- Lecture slides
- Section 5 slides and solution slides and Section 5 worksheet (HTML) and Section 5 solutions (HTML)
- Homework 4 Written
6. Web applications and AI-assisted programming
In this topic, we will learn the basics of full stack web development, as an example of a moderately complex type of programming. We will also explore what AI assistance can and cannot do for us in software development.
- Reading for Monday 5/4 Chapters 1 and 2 of Agentic Engineering by Simon Willison
- Reading for Wednesday 5/6 The Vibes Don't Scale by Paul Stack
- Section 6 (Midterm Review) solution slides and Section 6 worksheet (HTML) and Section 6 solutions (HTML)
7. Type Polymorphism
In this topic, we will look at ways that we can write code that can be used for types without any changes. The first way is through the use of subtypes. The second way is through the use of type parameters, which are called “generics” in Java.
- Lecture slides