DEV Community


Discussion on: What Do You Think About Immutable Data?

solkimicreb profile image
Miklos Bertalan Author

I think immutable data is okay on the backend but overused on the front-end. I like the simplicity and terseness of mutable objects when I have to deal with a lot of (short-term) persistent state and I never had issues with using mutable data. Of course, I have to pay attention to not mutate others' objects and I use immutable updates in these cases. Switching to a 100% immutability is an overkill though.

I also blame the broader phenomenon of thinking about code and not about products on immutable data and other trending patterns. I think people should worry much less about code beauty and much more about the product they are building. The massive amount of 'pattern propaganda' is making this difficult though.

On the other hand, I admire the elegance of immutable data - paired with functional programming - and I am glad I learned the foundations. For me, it's similar to the math I learned in university. I think it improved me in many fields but I rarely use it directly.