4 ms·
Thanks, that's a great answer and helps me understand. I guess there are subsets of problems where immutability is a good idea (anything needing state, 'Undo'
by porker 11y ago
Thanks, that's a great answer and helps me understand.
I guess there are subsets of problems where immutability is a good idea (anything needing state, 'Undo' capabilities), neutral, and a bad idea (number crunching, data processing, 'traditional'(??) programming).
I have been wowed by the beauty of the immutable approach in web apps, but definitely subscribe to the right technique for a task. I can't imagine doing the data processing in physics using an immutable language...
- bitL 11y agoIndeed it boils down to what you need to achieve. You might want to use both approaches and combine them for best performance/readability. There are specialized high-performance structures that are mutable (e.g. disruptor in HFT trading) optimizing all the way down to CPU cache lines to achieve unbelievable speeds, yet they work nicely if the objects they refer to are immutable. So just take all advices to switch to immutability with a grain of salt and learn to figure out which approach is suitable for what part of your system to have it both performing well and being able to conceptualize and maintain the code nicely ;-)