Quality Ladder - alexanderteplov/computer-science GitHub Wiki
Let's climb to these steps from level one to four.
- Correctness
- Efficiency
- Readability
- Extensibility
Code should be testable. You should understand the way you will test it and all the edge cases. Validate the input. Handle the exceptions.
Consider time efficiency, space efficiency, user interaction efficiency, etc.
Time efficiency is O(n) (Big-O notation) with taking into account size n and constant k.
The goal when writing any code is to be as efficient as possible under the given constraints.
Overdoing is bad too. This is known as "premature optimization" and should be avoided. Only optimize what you need to optimize.
The code you write is not yours. It belongs to your team (or even other teams).
A common industry practice used to get teams on the same page is called a coding style guide.
The most important thing is for your team’s code to be consistent. Your teammates will be the judge of your code’s readability
If you make your code too specific, the use case will be limited and every time the requirement changes, the code will need to be modified. If you make your code too generic, your clients need to do a lot to build on top of your code for their specific needs, and then it’s too difficult to use.