Reading 7: Abstraction Functions & Rep 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 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
- Reading 11: Abstraction Functions & Rep Invariantsweb.mit.edu
- Reading 10: Abstract Data Typesweb.mit.edu
- Reading 6: Abstract Data Typesweb.mit.edu
- Reading 10: Equalityweb.mit.edu
- Reading 15: Equalityweb.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Problem Set 2: Cityscapeweb.mit.edu
- Problem Set 2: Cityscapeweb.mit.edu
- Reading 11: Recursive Data Typesweb.mit.edu
- Abstractioncs.cornell.edu
- The Law of Leaky Abstractions – Joel on Softwarejoelonsoftware.com
- Reading 17: Recursive Data Typesweb.mit.edu