As software app developers, you will agree that we face all type of scenarios, from the easiest to the most complex projects. However, it is often the case that we fall into the trap of designing them in a more complex way than necessary.
In years spending in this fantastic world of programming, I have seen some really complex codes that don’t make sense. In other words, I have seen code that only the programmer who writes it can understand how it works. However, when one asks the programmer to explain what the code does, he or she would only say “Only God knows that”. I know there are scenarios when there are no easy ways to solve the issues, but why complicate them more if you could solve them with a simpler way?
That is why I would like to discuss some basic but very powerful principles that will make your life and most of your collaborators’ lives easier.
“Keep It Simple, Stupid” – The simpler your code is, the simpler it will be to maintain it in the future. This will be greatly appreciated by anyone else that needs to examine your code in the future. The KISS principle was coined by Kelly Johnson, and it states that most systems work best if they are kept simple rather than making them complex; therefore, simplicity should be a key goal in design and unnecessary complexity should be avoided.
“You Aren’t Gonna Need It” – Sometimes, as developers, we try to think way ahead, into the future of the project, coding some extra features “just in case we need them” or thinking“we will eventually need them”. Just one word: Wrong! You didn’t need it, you don’t need it and in most of the cases… “You Aren’t Gonna Need It”.
YAGNI is a principle behind the extreme programming (XP) practice of “Do the Simplest Thing That Could Possibly Work”. Even when this principle is part of XP, it is applicable in all kinds of methodologies and processes of development. By implementing the ideals of “You Aren’t Gonna Need It” programming, you will save yourself time and be able to move forward with projects efficiently.
“Don’t Repeat Yourself” – How many times do you see that there are similar codes in different parts of a system? The DRY principle, formulated by Andrew Hunt and David Thomas in their book The Pragmatic Programmer, states that “every piece of knowledge must have a single, unambiguous, authoritative representation within a system.” In other words, you must try to maintain the behavior of a functionality of the system in a single piece of code.
On the other hand, when the DRY principle is not followed, this is known as WET solutions, which stands for either Write Everything Twice or We Enjoy Typing.
There are a lot of other principles and good software app developement tips to increase productivity and efficiency, but I believe that these three are the basics. Putting them into practice will rescue you and your team from a lot of headaches trying to maintain code that people don’t understand.