Recorded talk @ ScotlandJS 2014 :: https://vimeo.com/96425437
JavaScript is a flexible, dynamic programming language, but along with this flexibility comes a cost: ubiquitous mutability. Trying to keep track of the internal state of your JavaScript application can be an endless source of confusion. As our applications get bigger and bigger, it only gets worse. In fact, mutable state is the cause of enough confusion and complexity that entire languages have been written around the idea of avoiding it!
We're taught to write our programs like they're a step-by-step set of instructions. We say "do this" and it happens; "change that", and it changes. We're encouraged to reassign variables and change the contents of our data structures at will, for example. In fact, ever since we wrote our first line of JavaScript, we've been taught that this dynamism is a good thing, but the problems mutability introduce are just something that we just have to put up with.
What if there was a better way? What if we could go a long way towards solving these problems and make our programs much easier to build, maintain and test? We can!
In this talk, we'll revisit exactly what we think we understand about 'state', look at the concept of 'values' as our core orientation, and look at how we can pull ourselves out of the complexity quagmire by taming our applications using immutability.