None of my team's programs care about multithreading, parallelisation, async, or anything else that benefit from immutability. However, immutability is clearly in fashion at the moment and I'm starting to believe that it assists readability. We typically use C#, but I don't think that's relevant.
If in a code review I find that a colleague has used a collection that was more mutable than it needed to be, should I point it out? For example what if I find they've used a List
where an ImmutableList
or ReadOnlyList
would have done?
My own thoughts on this matter are confused. On one hand, there's the two benefits that I mentioned earlier. On the other, I can only claim that code is "overly mutable" if I can guess ahead of time that the code will never need more mutability and it's tough to defend any claims that give only marginal benefits in readability.