Coding is not difficult to master if you are good at logic. However, how do you learn to code smarter than the rest of people? You can learn these tricks from my personal cookbook.
- The more you code, the shorter it gets.
- Simple logic works faster and more efficiently.
- Dare to rewrite and recode. Same rationale as point 1.
- If you find it hard to read, the computer will find it hard as well.
- Learn to understand the domain knowledge. This helps to select the right logic codes to fit task.
- If the decision making logic is more than 5 to 8. Consider to optimise it to reduce to 5.
- Speed is better than elegant codes. Users can feel the performance but cannot read how elegant is your coding.
- Know the cost of SQL. 1 long complex SQL is slower than few few simple ones.
It is good habit to know the timing of your codes. With practice, you will be smart to code for performance and maintainability.