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

Reading 5: Designing Specifications

web.mit.edu · 9,427 words · saved by 1 readers

In this reading we’ll look at different specs for similar behaviors, and talk about the tradeoffs between them. We’ll look at three dimensions for comparing specs: How deterministic it is. Does the spec define only a single possible output for a given input, or does it permit a set of legal outputs? How declarative it is. Does the spec just characterize what the output should be, or does it explicitly say how to compute the output? How strong it is. Does the spec have a small set of legal implementations, or a large set? Not all specifications we might choose for a module are equally useful, and we’ll explore what makes some specifications better than others. Consider these two implementations of find: The subscripts First and Last are not actual TypeScript syntax. We’re using them here to distinguish the two implementations for the sake of discussion. In the actual code, both implementations should be TypeScript methods called find. Since we’ll be talking about multiple specifications

Reading 5: Designing Specifications > hide Snapdown help Snapdown is a language for drawing snapshot diagrams. Click on the links below to see examples of Snapdown in action! In each example, you'll see a snippet of Snapdown syntax and the corresponding diagram side-by-side. Primitives (click to expand) In this example, we have two variables: i points to the value 5 , and s points to the value "abc" . i -> 5 s -> "abc" Objects (click to expand) In this example, f points to a MyFloat object with the value 5.0 , s points to a MyString object with the value "abc" . f -> (MyFloat 5.0) s -> (MyStri

Explore this link on the map →

related reading