I’ve long struggled with teaching Redux. It’s such a fundamental different way of thinking. When I search for comparisons to ease the concepts I always find myself sputtering words that never quite bridge that gap.
I’ve realized the reason I struggle with teaching Redux is because there is no easy bridge that can be used to get to the island that is Redux Comprehension. A learner is typically going from Object Oriented (OO) Land to Redux’s Functional Programming (FP) Land. On FP-Land things are done differently. Not better or worse, just differently. There’s a slight mental shift in how people go about their lives on FP-Land which can be a little weird and off-putting when first encountered. If you attempt to make sense of FP-Land from OO-Land you might end up making judgements and decisions that are not correct or fair until you’ve tried to live like a native resident of FP-Land.
Getting over this initial hurdle of understanding that things are done differently in FP-Land - which is where you’ll find Redux - is the first great hurdle to becoming a native.
The next great hurdle is actually making the journey from OO-Land to FP-Land.
When learning and discovering the vastness of OO-Land you’ll occasionally have to take bridges to different parts. Learning about Singletons or Factories or other OO programming styles require bridges of comprehension that you must walk over before you can use those styles of OO correctly. These bridges remain in OO-Land so there’s no great fear of anything going wrong. If the bridge starts to creak a little too loudly you can turn around and walk back to the area of OO-Land that you already know and find comfortable.
Unfortunately the journey to FP-Land is harder. It’s harder because there is no bridge to get there. Instead you have to swim across a channel of water that separates OO-Land from FP-Land. Swimming is harder than walking.
During this swim you’re performing double duty: not only do you have to keep your head above water and remain afloat but you also have to learn all the different ways that people do things on FP-Land, where Redux resides. While you’re swimming you’re also learning about reducers. While you’re holding your breath you’re learning about action creators. While you’re kicking your feet you’re learning about immutability.
During the swim it’s common to reminisce of happier, dryer times. Times on OO-Land where things made sense and you weren’t constantly out of breath. It’s common to try and use what you already know from OO-Land to make the swim easier. It’s fine to take short breaks and reflect on the differences between these two lands, however refrain from judging FP-Land from an OO-Land perspective. It will only make the swim harder.
Once you’ve finally made the journey across, congrats! Take a breath on FP-Land and reflect on your journey. All the new skills and ideas you picked up along the way. The benefits immutable data structures can provide. The expressiveness of composing functions. The joy of reducers!
Take some time to explore FP-Land and indulge your curiosities. You’ve made the difficult initial trek and now there’s a wealth of information that is much easier to access. You’ll encounter a couple of bridges of comprehension on FP-Land but that’ll be no sweat compared to the swim you just took.
Just don’t get too comfortable on FP-Land. You’ll want and need to visit OO-Land again. Unfortunately you’ll have to make that swim again. However each time you make that swim it’ll get easier. Then one day you won’t even notice the water. You’ll be a native on every land.