samedi 3 février 2018

Why should I use monads/pure functions for DOM in JavaScript?

I have read a number of articles about pure functions, functional programming and monads in JavaScript. They have changed my approach to programming, I love functional composition and I am always thinking about side effects my code can be causing.

When writing DOM manipulation, I should use a monad. However I feel like it makes my code more complex and harder to understand and so also harder to debug and easier to make an error.

I don't see how I am increasing testability. I haven’t found any article about testing code with monads. At the end I end up executing the manipulation saved in a monad and if I made an error I have to debug and side effects on dom remain the same.

What am I gaining by using a monad?

Aucun commentaire:

Enregistrer un commentaire