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

Reading 7: Abstraction Functions & Rep Invariants

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

In this reading, we study a more formal mathematical idea of what it means for a class to implement an ADT via the notions of abstraction functions and rep invariants. These mathematical notions are eminently practical in software design. The abstraction function gives us a way to cleanly define the equality operation on an abstract data type (which we’ll discuss in more depth in a future class). The rep invariant makes it easier to catch bugs caused by a corrupted data structure. Resuming our discussion of what makes a good abstract data type, the final, and perhaps most important, property of a good abstract data type is that it preserves its own invariants. An invariant is a property of a program that is always true, for every possible runtime state of the program, given it was true at the beginning. You may recall this concept of a preserved invariant from 6.1200 [formerly 6.042]. Immutability is one crucial invariant that we’ve already encountered: once created, an immutable objec

Reading 7: Abstraction Functions & Rep Invariants Reading 7: Abstraction Functions & Rep Invariants 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 Today’s reading introduces several ideas: invariants representation exposure abstraction functions representation invariants In this reading, we study a more formal mathematical idea of what it means for a class to implement an ADT via the notions of a

Explore this link on the map →

related reading