DEV Community


Discussion on: Hard to Read Code is Not Empathetic

simov profile image

You always have to balance between expressiveness and robustness/reliability.

Your short code snippet about the for loop is nice, but once your function start to balloon into more lines, having more and more state variables makes your code harder to read/maintain and much more prone to errors.

On the other hand writing functional code, just to save yourself from having a proper conditional if, and a state, because that implies it, is not always worth it in terms of maintainability of your code.