DEV Community


Discussion on: What Do You Think About Immutable Data?

awwsmm profile image
Andrew (he/him)

I like to think that there's no such thing as mutable data. Data doesn't change, it just gets replaced by new data. Like measuring the temperature over the course of the day, the "old data" is still valid for the "old time", while the "new data" is valid for the "new time".

Some logbook software, for instance, will never let you truly delete anything that's ever been committed to the logbook. There will be a record in the book of the old data, a record of the fact that you "deleted" it, and a record of the fact that you replaced it with something new.

Immutable data like this offers lots of advantages in programming in terms of type checking, cached function evaluation, etc., but it also -- of course -- makes the job of the programmer a bit more difficult.