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

Reading 10: Equality

web.mit.edu · 6,543 words · saved by 1 readers

In the previous readings we’ve developed a rigorous notion of data abstraction by creating types that are characterized by their operations, not by their representation. For an abstract data type, the abstraction function explains how to interpret a concrete representation value as a value of the abstract type, and we saw how the choice of abstraction function determines how to write the code implementing each of the ADT’s operations. In this reading we turn to how we define the notion of equality of values in a data type: the abstraction function will give us a way to cleanly define the equality operation on an ADT. In the physical world, every object is distinct – at some level, even two identical snowflakes are different, even if the distinction is just the position they occupy in space. So two physical objects are never truly “equal” to each other; they only have degrees of similarity. In the world of human language, however, and in the world of mathematical concepts, you can have

Reading 10: Equality Reading 10: Equality 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 the properties of an equivalence relation. Understand equality for immutable types defined in terms of the abstraction function and in terms of observation. Differentiate between reference equality and object equality. Differentiate between observational and behavioral equality for mutable types. I

Explore this link on the map →

related reading