Skip to content

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

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.

  • 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.
Wk6.031 readingTopic
101static checking; what a type checker can and cannot see
202 → Pythontypes and mypy against backend/; reading the mypy baseline
303testing: black box, glass box, boundaries, coverage
404code review: what to look for, what to refuse to comment on
505, 23version control, branches, the PR as the unit of work
606specifications: preconditions, postconditions, exceptions
707designing specifications: weaker vs stronger, underdetermined
808, 11avoiding debugging; debugging methodology when it happens anyway
909mutability, aliasing, immutability — Django queryset edition
1012, 13abstract data types; abstraction functions and rep invariants
1115 + refactoringequality/hashing; refactoring catalog, legacy seams
12—Reading week
  • 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.

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.

BookAuthor, yearUseFree
Unit Testing: Principles, Practices, and PatternsVladimir Khorikov, 2020What to test, what to mock, when a test is worth its cost — the most useful book here for a QA engineerNo
Refactoring, 2nd ed.Martin Fowler, 2018The catalogue; browsable free at refactoring.comNo
Working Effectively with Legacy CodeMichael Feathers, 2004Getting untested code under test — the actual FTM situation in placesNo
Software Engineering at GoogleWinters, Manshreck, Wright, 2020Testing culture, code review, deprecation at scale; abseil.io/resources/swe-bookYes
Effective Java, 3rd ed.Joshua Bloch, 2018Optional; pairs with 6.031’s idioms if the Java readings need groundingNo

Coursework 45% (L1–L4) · Project 35% · Check-off viva 10% · Exam 10%.