Instances and equality

The concept of classes and instances is vague in reality.

Example: books

The class Book might have an instance for the book Crafting Interpreters by Robert Nystrom, but even that Book instance is a class in and of itself. My copy of the book is different from someone else’s copy of the book. The identity of a Book might be the ISBN, but my copy of the book might be identified by ISBN and the fact that it’s mine.

Example: tracks

At SoundCloud, the concept Track ran into similar issues. A Track is not a piece of music, because a piece of music can have various recordings. A Track is also not even a recording, because the same recording could be uploaded to SoundCloud multiple times, to different accounts. The best I could come up with is that a Track is an instance of a recording.

When is a track “equal” to another track? Are two tracks the same when they correspond to the same recording? Or are they equal when the piece of music is equal? Or are two tracks equal only if they’re the same recording and uploaded to the same account?

See also

Equality in programming languages
Fungibility and equality

Note last edited January 2022.
Backlinks: Equality in programming languages.