Oct 16, 2021
I agree with you - in my own codebases I prefer functional style and immutable stuff wherever possible.
But the real world isn't perfect and sometimes you need to maintain large, legacy codebase with tons of mutables.
In this article I tried to find example as simple as possible, but initially I encountered this "pitfall" in a class inheriting from Android View and managing some [mutable] properties given by React Native. And just making these immutable simply wasn't possible.