Clean Code

Keep It Simple

Keep It Simple

Reading Time: 4 minutes

Recently I forced myself to try FRP (functional reactive programming) on an IOS project that I’m working on in my spare time in order to examine how to make my code more simple and readable. I tried to add to my MVVM architecture the reactive aspect with RxSwift, and I have always wanted to figure out what is the buzz with Rx. Maybe I am not the best reactive code programmer but it was a mess. It looked like a lot of mumbo-jumbo in order to achieve data bindings for simple implementation of MVVM architecture.

I know I probably misused the library and its purpose is basically to deal with streams and data bindings is only a side effect which you can achieve with it. It looked like a lot of magic going on and I personally don’t like magics, especially not in my code. The code started to be much less readable than the straight forward code I wrote before, so I decided to keep the RX out of my MVVM implementation, it was simply an overkill for me, and as I read more I am not the only one who thought so. Indeed the code base was a little bit smaller, but not readable to most of the developers.

Eventually I kept the RX library in my dependencies though to deal with streams which I will eventually have to deal with in the near future, I hope to write about it and give also compliments to the reactive programming style.

As a quotes lover here are some good quotes about keeping code simple:

“So if you want to go fast, if you want to get done quickly, if you want your code to be easy to write, make it easy to read.”  – Robert C. Martin

“Programs must be written for people to read, and only incidentally for machines to execute.” – Hal Abelson

And as a GIF lover here is one of my favorites: