Syllabus Lesson 98 of 141 · Devil's advocate
Devil's advocate

The pre-mortem

Why it matters Asking "what could go wrong?" gets polite, vague answers. Asking "it went wrong: why?" gets specific ones, because you are explaining a story instead of guessing a risk.

Pre-mortem: before launch, imagine the project has already failed, then write down the reasons. Each reason is a risk you can check for now.

Marketing launches a voucher campaign on Monday. The voucher service is small:

v = make()
v.add("SAVE10", uses=500, expires=30)   # valid until day 30, inclusive
v.redeem("SAVE10", "ann", today=3)       # True: accepted
v.redeem("SAVE10", "ann", today=4)       # False: once per customer

It is a month later and the campaign was a disaster. Write the reasons. A sparring prompt that helps: "This voucher launch failed badly. Write five different post-incident summaries." Then turn every reason into a check. Six hidden versions of the service each have one fault injected; your checks run against all of them.

Your turn

Set premortem to a list of at least 4 reasons the launch failed (plain sentences). Then write check_launch(make): make() returns a fresh voucher service, and your function must raise if it breaks a rule. The rules: add(code, uses, expires) creates a code; redeem(code, user, today) returns True or False; codes are not case sensitive; each user can redeem a code once; a code is accepted at most uses times; it works up to and including day expires, not after; a refused attempt uses nothing up; an unknown code returns False (it never raises). Pass bar: pass the correct service and catch at least 4 of the 6 faulty ones.

Spotted a problem in this lesson? Report it · Ask about this lesson

This exercise opens soon

Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.