DEV Community

Discussion on: Declaring Variables in JavaScript

diegomgar profile image
Dieg Oto

Why that obsession with immutable objects? I don't understand it.

daniel13rady profile image
Daniel Brady Author

Ooo, thanks for asking. I'll have to write a post about mutable and immutable approaches to state management, I think it's a fascinating topic! And another case where people tend to use one programming tool over another without really thinking deeply about why.

But with respect to the "obsession over immutable objects" that is so commonplace these days, I think it has a lot to do with the types of problems people are solving (many of which fall into the "immutable objects are great for this" category), as well as the increase in mental overhead that managing application state can put on us as developers.

Not the only reasons, of course, it's a broad topic, just my off-the-cuff impression. I'm looking forward to digging deeper 😀