How to code effectively

  1.  First principle is, write code. Automate anything that you have to do repeatedly and can be automated easily.
  2. Write short code. Less code means less code that can go wrong, which means a more maintainable code. One way to do this is to break your code into modular reusable peices that talk to each other. OOC also comes in here, where you are creating algorithmic objects to represent real life objects that you are trying to model, so instead of dealing with variables like color1, size1, you have obj1.color, obj1.size, etc.
  3. It is better to computationally undershoot than to overshoot, because in the latter case, you spent more resources to get the same garbage.
  4. Visualize to debug. You think your code is doing what you intend it to do, but it is not. Look for discrepancies. Visual feedback is works well to spot unintended behaviour.

Comments