CS301 · Software Construction, Testing & Refactoring
Learning materials — eleven chapters, each with a cited reading, a worked example and a 20-mark problem set. Examination paper — 2 h 30 · 100 marks · grade descriptors · every question mapped to a chapter.
Credits 8 · Hours 80 · Prereqs CS202 · Semester 2
Source course
Section titled “Source course”MIT 6.031 — Software Construction (Spring 2017). https://web.mit.edu/6.031/www/sp17/
No textbook. The course states its readings are self-authored online exercises graded for completion. The framing is the three properties every design decision is judged against: safe from bugs, easy to understand, ready for change.
Published reading list (28 items, verbatim): 01 Static Checking · 02 Basic Java · 03 Testing · 04 Code Review · 05 Version Control · 06 Specifications · 07 Designing Specifications · 08 Avoiding Debugging · 09 Mutability & Immutability · 10 Recursion · 11 Debugging · 12 Abstract Data Types · 13 Abstraction Functions & Rep Invariants · 14 Interfaces & Enumerations · 15 Equality · 16 Recursive Data Types · 17 Regular Expressions & Grammars · 18 Parsers · 19 Concurrency · 20 Thread Safety · 21 Locks & Synchronization · 22 Queues & Message-Passing · 23 Team Version Control I · 24 Sockets & Networking · 25 Callbacks · 26 Map, Filter, Reduce · 27–28 Little Languages.
Used: 01–16, 23. Dropped: 17–18 (parsers), 19–22 (concurrency — FTM’s concurrency is Postgres and the task queue, covered in CS202 and FTM301), 24–28.
Objectives
Section titled “Objectives”- Write the specification before the body.
- Tell testing, debugging and proving apart.
- Refactor without changing behaviour.
- Review a PR usefully, and decide what level a test belongs at.
Weekly map
Section titled “Weekly map”| Wk | 6.031 reading | Topic |
|---|---|---|
| 1 | 01 | static checking; what a type checker can and cannot see |
| 2 | 02 → Python | types and mypy against backend/; reading the mypy baseline |
| 3 | 03 | testing: black box, glass box, boundaries, coverage |
| 4 | 04 | code review: what to look for, what to refuse to comment on |
| 5 | 05, 23 | version control, branches, the PR as the unit of work |
| 6 | 06 | specifications: preconditions, postconditions, exceptions |
| 7 | 07 | designing specifications: weaker vs stronger, underdetermined |
| 8 | 08, 11 | avoiding debugging; debugging methodology when it happens anyway |
| 9 | 09 | mutability, aliasing, immutability — Django queryset edition |
| 10 | 12, 13 | abstract data types; abstraction functions and rep invariants |
| 11 | 15 + refactoring | equality/hashing; refactoring catalog, legacy seams |
| 12 | — | Reading week |
FTM labs
Section titled “FTM labs”- L1 write specs for four undocumented
backend/functions, then check each against reality. - L2 review a real merged PR as if it were open, before reading the discussion; diff the two reviews.
- L3 refactor one long view function with tests green at every step.
- L4 convert a real QA card’s AC1…ACn into executable tests.
Project
Section titled “Project”A test suite pinning three FTM invariants — fee arithmetic, booked state immutable, one band per enquiry — plus a mutation check proving each test fails when the logic is broken. Merged to master.
Reading list
Section titled “Reading list”| Book | Author, year | Use | Free |
|---|---|---|---|
| Unit Testing: Principles, Practices, and Patterns | Vladimir Khorikov, 2020 | What to test, what to mock, when a test is worth its cost — the most useful book here for a QA engineer | No |
| Refactoring, 2nd ed. | Martin Fowler, 2018 | The catalogue; browsable free at refactoring.com | No |
| Working Effectively with Legacy Code | Michael Feathers, 2004 | Getting untested code under test — the actual FTM situation in places | No |
| Software Engineering at Google | Winters, Manshreck, Wright, 2020 | Testing culture, code review, deprecation at scale; abseil.io/resources/swe-book | Yes |
| Effective Java, 3rd ed. | Joshua Bloch, 2018 | Optional; pairs with 6.031’s idioms if the Java readings need grounding | No |
Assessment
Section titled “Assessment”Coursework 45% (L1–L4) · Project 35% · Check-off viva 10% · Exam 10%.