The current article shares the coding principle which we developed through our accumulated experience.
There are 4 keywords we keep in mind when writing codes which are readability, feasibility, scalability, and performance. In addition, we treat the importance in order.
Readability >>> Feasibility > Scalability >>> Performance
1. Readability
What we treat the most important is readability. Although the code is not running as expected, the readable code can be fixed and live until it is actually working. When it isn’t readable, the code may get thrown away and replaced by the other developers.
2. Feasibility
The code needs to run as expected. This is of course important for all developers. However, this should be taken care of after the readability. Although you’ve written a runnable code, when very few other people understand your code, it should seriously be considered to be refactored.
3. Scalability
When the code faced limitations, developers likely rewrite similar code on the other side and fit the requirement. This usually is a threat to readability which is the most important.
For example, if you have the React component and the code can’t add another feature, the developer will be writing on code that is similar to the previous React component. This will make more lines of a similar logic and newcomers will be confused until they find out the reason for the previous limitation. This can be improved slowly but you should be aware that the code must be improved.
Try to expose more possibilities to reduce the duplicates. While doing that try to make it as compact as possible.
4. Performance
Lastly, we care about performance. Usually, when writing a thesis about computer science, performance is frequently mentioned. However, we find that this doesn’t occur much in real life.
This does not mean that we do not care about performance. All four principles we mentioned should not fall from our code. When performance issues arise, readable code is much easier to troubleshoot and this is why we stated that readability is most important.
People may disagree with our principles. Also, our thought may change in the future. However, this is our current status and will be bringing forward until we see any defect.
The priorities in our principles do not mean that one of them can be dropped in some cases. They must live all together.