A little bit more about KISS

KISS? Really? Again?

As you know, KISS stands for Keep It Simple. There are many resources out there explaining what Simple stands for. I’ll also explain it from my own point of view, but I think the main word in this acronym is “Keep”. And through it, I’ll reveal this topic.

First of all, I have to say that for keeping the system simple, you have to try not to accept complex business requirements. If the requirements look complex, you may not be able to implement them simply. Thus, you should be involved in discussing and grooming them.

Well, why did I focus on the word «Keep»? Let’s say we have written a component that makes an outgoing call if incoming was disrupted.

According to current business requirements, we have the simple call button component that gets a phone number and makes a call, also it can drop a call.

The application evolves and now we don’t have to have an incoming call terminated for an outgoing call. Now we can create a new client, call him or select an existing client, and get his default number or other for outgoing calls. We have reviewed the new requirements and thought that this button still makes an outgoing call and doesn’t violate DRY and Single Responsibility principles. So let’s do it.

Are you see? Have we been able to keep it simple? Absolutely not! Now, we are needed to look after compliance conditions to render the appropriate component. And if requirements change we have to implement them without breaking the current implementation. This implementation makes maintenance more expensive because we spend more time remembering what is going on in the code. In addition, we need more time to implement new requirements, more time to test, etc. Of course, such difficulties create more bugs. Well, how can we improve this situation? Let’s use the principle of single responsibility! If we look at the previous implementation, we can see that the number of phone numbers is the main condition for rendering.

Now we wait for the list of strings to display the corresponding component. And the getPhoneNumberList function will create it. Note that we’ve kept the logical ordering using the OR operator. Let’s see how our component looks now.

It looks simpler, isn’t it? If you liked this article, you may also like the article about DRY.

Front end developer, Moscow