Functional lessons learnt

  • Respect the purity of the functions. Keeping your code pure makes it easier to test and overall more predictable. A function is pure when it doesn’t create side effects and only affect the context within the function itself, not outside.
  • Focus on the order of parameters to increase the readability of your code. Go with either horizontal or vertical functions. Avoid mixing them as much as possible. Start by keeping the function heads consistent in the order of parameters.
  • Applying transformations to your data structures and always making sure you return that same data structure can help endlessly pipe your reducers, and achieve vertical functions.
  • Keep your data private and your behaviour public. That way, modifying the underlying implementation of your behaviour will never affect the users of your API.

Full post here, 11 mins read