flâneur — a map of the web's best reading

Reading 4: Specifications

web.mit.edu · 7,318 words · saved by 1 readers

Specifications are the linchpin of teamwork. It’s impossible to delegate responsibility for implementing a function without a specification. The specification acts as a contract: the implementer is responsible for meeting the contract, and a client that uses the function can rely on the contract. In fact, we’ll see that like real legal contracts, specifications place demands on both parties: when the specification has a precondition, the client has responsibilities too. In this reading we’ll look at the role played by specifications of functions. We’ll discuss what preconditions and postconditions are, and what they mean for the implementer and the client of a function. We’ll also talk about how to use exceptions, an important language feature found not only in TypeScript, but also Python, Java, and many other modern languages, which allows us to make a function’s interface safer from bugs and easier to understand. Suppose you are working on a program containing this function, which fi

Reading 4: Specifications Reading 4: Specifications Praxis Tutor exercises Keep making progress on TypeScript by completing the following categories in the Praxis Tutor: ✓ Comments & Assertions 1/1 ✓ Exceptions 1/1 Software in 6.102 Safe from bugs Easy to understand Ready for change Correct today and correct in the unknown future. Communicating clearly with future programmers, including future you. Designed to accommodate change without rewriting. Objectives Understand preconditions and postconditions in function specifications, and be able to write correct specifications Be able to write test

Explore this link on the map →

saved by

related reading