Quality of Code
There are many definitions for Quality of code from my
research this few days. As we know, we try to improve our code, not only for the
author but also other people in the team. If I could list what are the good
code should be, it should be like this;
- No redundant or repeat code: if you have several lines of code with the same action, you should make it to the new function. For this advantage, you will have another short command that can reuse many times.
- Code readable
- Use good name for function or variable
- Good comment and document
- But if you have a good code it should understandable without comment. Source code itself says what the code does and how
- Right responsibility for each function: one responsibility for one function.
- Optimize resource/efficient: Poorly written code will not take account of resource usage, for example it will not cache information it could cache, or it will create new objects when it did not need to. These issues lead to hard to maintain applications when deployed and used.
- Well organized: should be easy to find what variable goes to which function, where you locate your code.
- Have code review: ask some other person for each some important part
No comments:
Post a Comment